プロジェクト

全般

プロフィール

リビジョン 365

堀内6年以上前に追加

担当者の期間内部署移動時に台帳一覧の表示人件費計算がおかしくなるバグを修正
一覧選択画面、期数・部署・担当者を変更時にエラーがあればコンボボックスのイベントが消えてしまうバグ修正

差分を表示:

branches/src/ProcessManagement/ProcessManagement/Common/CommonMotions.cs
2986 2986
                bool bFirst = true;
2987 2987
                foreach (object[] ObjRec in TargetList)
2988 2988
                {
2989
                    int DepartmentCode = CommonMotions.cnvInt(ObjRec[(int)CommonLedgerData.GetPersonTerm.DepartmentCode]);
2989 2990
                    int PersonCode = CommonMotions.cnvInt(ObjRec[(int)CommonLedgerData.GetPersonTerm.PersonCode]);
2991
                    int nKeyCode = (DepartmentCode * 100000000) + PersonCode;
2990 2992
                    DateTime dtStart = CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.StartDate]);
2991 2993
                    DateTime dtLast = CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.CompDate]);
2992 2994

  
2993 2995
                    if (!bFirst) strSQL.Append(" UNION ");
2994 2996

  
2995
                    strSQL.AppendFormat("SELECT {0} As LinkKey, SUM(SAL{0}.SALARY) FROM", PersonCode);
2997
                    strSQL.AppendFormat("SELECT {0} As LinkKey, SUM(SAL{0}.SALARY) FROM", nKeyCode);
2996 2998

  
2997 2999
                    strSQL.Append(" (SELECT AX.hiduke,");
2998
                    //strSQL.AppendFormat(" ROUND((AX.salary * {0}) / DATE_FORMAT(LAST_DAY(AX.hiduke), '%d')) AS SALARY,", CommonDefine.s_SalaryCorrection);
2999 3000
                    strSQL.AppendFormat(" ROUND((AX.salary * {0}) / 30) AS SALARY,", CommonDefine.s_SalaryCorrection);
3000 3001
                    strSQL.Append(" MAX(AX.StartD) FROM");
3001 3002
                    strSQL.Append(" (SELECT A.d hiduke, B.MonthlySalary salary, B.STARTDATE StartD FROM");
......
3065 3066
                    strSQL.Append(" ORDER BY A.d, B.STARTDATE DESC) AS AX");
3066 3067
                    strSQL.Append(" GROUP BY AX.hiduke");
3067 3068
                    strSQL.Append(" ORDER BY AX.hiduke");
3068
                    strSQL.AppendFormat(" ) AS SAL{0}", PersonCode);
3069
                    strSQL.AppendFormat(" ) AS SAL{0}", nKeyCode);
3069 3070

  
3070 3071
                    bFirst = false;
3071 3072
                }
......
3106 3107
                int PrevTargetYear = (TargetYear - 1);
3107 3108
                if (PrevTargetYear < 1) return;
3108 3109

  
3110
                List<KeyValuePair<int, int>> wrkManCode = new List<KeyValuePair<int, int>>();
3109 3111
                List<KeyValuePair<DateTime, DateTime>> wrkStEdDate = new List<KeyValuePair<DateTime, DateTime>>();
3110 3112
                bool bFirst = true;
3111 3113
                StringBuilder strSQL = new StringBuilder();
......
3120 3122
                                        CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.HireCompDays]),
3121 3123
                                        CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.NextStartDate]),
3122 3124
                                        CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.NextCompDate]),
3125
                                        CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.DepHistoryStartDate]),
3126
                                        CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.DepHistoryCompDate]),
3123 3127
                                        ref stDate, ref edDate);
3124 3128

  
3129
                    int nDepCode = CommonMotions.cnvInt(ObjRec[(int)CommonLedgerData.GetPersonTerm.DepartmentCode]);
3125 3130
                    int nPersonCode = CommonMotions.cnvInt(ObjRec[(int)CommonLedgerData.GetPersonTerm.PersonCode]);
3131

  
3132
                    wrkManCode.Add(new KeyValuePair<int,int>(nDepCode, nPersonCode));
3126 3133
                    wrkStEdDate.Add(new KeyValuePair<DateTime, DateTime>(stDate, edDate));
3127 3134

  
3128 3135
                    // 今期の最初が先期の最後より大きい場合は処理しない
......
3189 3196
                if (!SalDB.ExecuteReader(strSQL.ToString(), ref ArData)) return;
3190 3197

  
3191 3198
                int DateCnt = 0;
3199
                int NextDiffDay = 0;
3200
                int PrevDiffDay = 0;
3192 3201
                foreach (object[] ObjRec in TargetList)
3193 3202
                {
3203
                    int nDepCode = CommonMotions.cnvInt(ObjRec[(int)CommonLedgerData.GetPersonTerm.DepartmentCode]);
3194 3204
                    int nPersonCode = CommonMotions.cnvInt(ObjRec[(int)CommonLedgerData.GetPersonTerm.PersonCode]);
3195 3205

  
3196 3206
                    // 半端分の日数を取得する
3197
                    int NextDiffDay = ArData.Cast<object[]>().Where(x => CommonMotions.cnvInt(x[0]) == TargetYear
3207
                    NextDiffDay = 0;
3208
                    PrevDiffDay = 0;
3209
                    NextDiffDay = ArData.Cast<object[]>().Where(x => CommonMotions.cnvInt(x[0]) == TargetYear
3198 3210
                                                                    && CommonMotions.cnvInt(x[2]) == nPersonCode)
3199 3211
                                                            .Sum(y => CommonMotions.cnvInt(y[7]));
3200 3212

  
3201 3213
                    // 先期の半端分の日数を取得する
3202
                    int PrevDiffDay = ArData.Cast<object[]>().Where(x => CommonMotions.cnvInt(x[0]) == PrevTargetYear
3214
                    PrevDiffDay = ArData.Cast<object[]>().Where(x => CommonMotions.cnvInt(x[0]) == PrevTargetYear
3203 3215
                                                                    && CommonMotions.cnvInt(x[2]) == nPersonCode)
3204 3216
                                                            .Sum(y => CommonMotions.cnvInt(y[7]));
3217
                    // 同じデータを探す
3218
                    DateCnt = 0;
3219
                    foreach (KeyValuePair<int, int> CurRec in wrkManCode)
3220
                    {
3221
                        if (CurRec.Key == nDepCode && CurRec.Value == nPersonCode) break;
3222
                        DateCnt++;
3223
                    }
3224
                    KeyValuePair<DateTime, DateTime> CurStEd = wrkStEdDate[DateCnt];
3205 3225

  
3206
                    KeyValuePair<DateTime, DateTime> CurStEd = wrkStEdDate[DateCnt++];
3226
                    DateTime dtDepMove = CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.DepHistoryStartDate]);
3227
                    
3207 3228
                    // 今期終了日変更
3208 3229
                    DateTime wrkDate = CurStEd.Value.AddDays(NextDiffDay);
3209 3230
                    if (dtDefaultEnd.Date < wrkDate.Date) wrkDate = dtDefaultEnd;
3210 3231
                    ObjRec[(int)CommonLedgerData.GetPersonTerm.CompDate] = wrkDate;
3232

  
3233
                    if (dtDepMove.Date == CurStEd.Key.Date) PrevDiffDay = 0;    // 部署移動日がセットされている場合は日付を変えない
3211 3234
                    // 今期開始日変更
3212 3235
                    wrkDate = CurStEd.Key.AddDays(PrevDiffDay);
3213 3236
                    if (dtDefaultEnd.Date < wrkDate.Date) wrkDate = dtDefaultEnd;
......
3230 3253
                                        DateTime dtDefaultStart, DateTime dtDefaultEnd,
3231 3254
                                        DateTime HireStartDate, DateTime HireCompDate,
3232 3255
                                        DateTime NextStartDate, DateTime NextCompDate,
3256
                                        DateTime DepHisStDate, DateTime DepHisCompDate,
3233 3257
                                        ref DateTime StartDate, ref DateTime CompDate)
3234 3258
        {
3235 3259
            try
3236 3260
            {
3237 3261
                // ----- 計算開始日セット
3238
                if (StartDate == DateTime.MinValue)
3262
                if (StartDate.Date == DateTime.MinValue.Date)
3239 3263
                {
3240 3264
                    StartDate = dtDefaultStart;
3241 3265
                }
3242
                else if (dtDefaultStart <= HireStartDate && HireStartDate <= dtDefaultEnd)
3266
                else if (dtDefaultStart.Date <= HireStartDate.Date && HireStartDate.Date <= dtDefaultEnd.Date)
3243 3267
                {
3244 3268
                    StartDate = HireStartDate;
3245 3269
                }
3246
                else if (dtDefaultStart < StartDate)
3270
                else if (dtDefaultStart.Date < StartDate.Date)
3247 3271
                {
3248 3272
                    StartDate = dtDefaultStart;
3249 3273
                }
3250 3274
                // 入社日が期内ならば開始を入社日にする
3251
                if (dtDefaultStart < HireStartDate && HireStartDate < dtDefaultEnd) StartDate = HireStartDate;
3275
                if (dtDefaultStart.Date < HireStartDate && HireStartDate.Date < dtDefaultEnd.Date)
3276
                {
3277
                    StartDate = HireStartDate;
3278
                }
3252 3279

  
3253 3280
                // ----- 計算終了日セット
3254 3281
                // Defaultは期末
3255 3282
                CompDate = dtDefaultEnd;
3256 3283

  
3257 3284
                // 退社日が期内ならば終了を退社日にする
3258
                if (dtDefaultStart < HireCompDate && HireCompDate < dtDefaultEnd) CompDate = HireCompDate;
3285
                if (dtDefaultStart.Date < HireCompDate.Date && HireCompDate.Date < dtDefaultEnd.Date)
3286
                {
3287
                    CompDate = HireCompDate;
3288
                }
3259 3289

  
3260 3290
                // 来季の開始があって期末日より小さい場合は置き換える
3261
                if (NextStartDate != DateTime.MinValue)
3291
                if (NextStartDate.Date != DateTime.MinValue.Date)
3262 3292
                {
3263
                    if (StartDate < NextStartDate && NextStartDate < CompDate) CompDate = NextStartDate.AddDays(-1);
3293
                    if (StartDate.Date < NextStartDate.Date && NextStartDate.Date < CompDate.Date)
3294
                    {
3295
                        CompDate = NextStartDate.AddDays(-1);
3296
                    }
3264 3297
                }
3298

  
3299
                // ----- 部署移動があればそちらの年月日を使用する
3300
                // 移動開始年月日が今期ならばセットする
3301
                if (dtDefaultStart.Date <= DepHisStDate.Date && DepHisStDate.Date <= dtDefaultEnd.Date)
3302
                {
3303
                    if (StartDate.Date < DepHisStDate.Date) StartDate = DepHisStDate;
3304
                }
3305

  
3306
                // 移動終了年月日が今期ならばセットする
3307
                if (dtDefaultStart.Date <= DepHisCompDate.Date && DepHisCompDate.Date <= dtDefaultEnd.Date)
3308
                {
3309
                    if (DepHisCompDate.Date < CompDate.Date) CompDate = DepHisCompDate;
3310
                }
3311

  
3312

  
3265 3313
            }
3266 3314
            catch (Exception ex)
3267 3315
            {
......
3583 3631
                strSQL.AppendFormat(" OR DATE('{0}') = DATE(B.CompDate)))", DateTime.MinValue.ToShortDateString());
3584 3632

  
3585 3633
                strSQL.AppendFormat(" AND A.PersonCode = {0}", nPersonCode);
3634
                strSQL.Append(" Order By B.ComplateDate desc");
3586 3635
            }
3587 3636
            catch (Exception ex)
3588 3637
            {
branches/src/ProcessManagement/ProcessManagement/Common/CommonVersion.cs
14 14
        /// <summary>
15 15
        /// 本体バージョン
16 16
        /// </summary>
17
        public static int s_SystemVersion = 217;
17
        public static int s_SystemVersion = 220;
18 18

  
19 19
        /// <summary>
20 20
        /// コピー・環境バージョン
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstractionList/FrmConstructionList.cs
293 293
        /// <param name="e"></param>
294 294
        private void numUDConstPro_ValueChanged(object sender, EventArgs e)
295 295
        {
296
            // ?C?x???g?N???A
297
            SubControlEvent();
296
            try
297
            {
298
                // ?C?x???g?N???A
299
                SubControlEvent();
298 300

  
299
            // ?????R???{?{?b?N?X??X
300
            SetcmbDepartment();
301
            // ?S????R???{?{?b?N?X??X
302
            SetcmbPersons();
301
                // ?????R???{?{?b?N?X??X
302
                SetcmbDepartment();
303
                // ?S????R???{?{?b?N?X??X
304
                SetcmbPersons();
303 305

  
304
            // ?f?[?^?\??
305
            DataDisplay();
306

  
307
            // ?C?x???g?Z?b?g
308
            SetControlEvent();
306
                // ?f?[?^?\??
307
                DataDisplay();
308
            }
309
            finally
310
            {
311
                // ?C?x???g?Z?b?g
312
                SetControlEvent();
313
            }
309 314
        }
310 315
        #endregion
311 316

  
......
317 322
        /// <param name="e"></param>
318 323
        private void cmbDepartment_SelectedIndexChanged(object sender, EventArgs e)
319 324
        {
320
            // ?C?x???g?N???A
321
            SubControlEvent();
325
            try
326
            {
327
                // ?C?x???g?N???A
328
                SubControlEvent();
322 329

  
323
            // ?S????R???{?{?b?N?X??X
324
            SetcmbPersons();
330
                // ?S????R???{?{?b?N?X??X
331
                SetcmbPersons();
325 332

  
326
            // ?f?[?^?\??
327
            DataDisplay();
328

  
329
            // ?C?x???g?Z?b?g
330
            SetControlEvent();
333
                // ?f?[?^?\??
334
                DataDisplay();
335
            }
336
            finally
337
            {
338
                // ?C?x???g?Z?b?g
339
                SetControlEvent();
340
            }
331 341
        }
332 342

  
333 343
        #endregion
......
340 350
        /// <param name="e"></param>
341 351
        private void cmbConstructionPerson_SelectedIndexChanged(object sender, EventArgs e)
342 352
        {
343
            // ?C?x???g?N???A
344
            SubControlEvent();
353
            try
354
            {
355
                // ?C?x???g?N???A
356
                SubControlEvent();
345 357

  
346
            // ?S????R???{?{?b?N?X?Z?b?g?????????Z?b?g????
347
            if (!SetPerosonToDepartment()) return;
358
                // ?S????R???{?{?b?N?X?Z?b?g?????????Z?b?g????
359
                if (!SetPerosonToDepartment()) return;
348 360

  
349
            // ?f?[?^?\??
350
            DataDisplay();
351

  
352
            // ?C?x???g?Z?b?g
353
            SetControlEvent();
361
                // ?f?[?^?\??
362
                DataDisplay();
363
            }
364
            finally
365
            {
366
                // ?C?x???g?Z?b?g
367
                SetControlEvent();
368
            }
354 369
        }
355 370
        #endregion
356 371

  
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstractionList/FrmConstructionListAuxiliary.cs
2172 2172

  
2173 2173
                int nTargetCount = (int)numUDConstPro.Value;
2174 2174
                int DepartmentCode = GetDepartmentCode();
2175
                if (DepartmentCode > 0) return true;
2175 2176

  
2176 2177
                StringBuilder strSQL = new StringBuilder();
2177 2178
                CommonMotions.CreateMan2DepSQL(ref strSQL, nTargetCount, PersonCode);
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionBaseInfo/FrmConstructionBaseInfo.cs
1662 1662
            if (!rdbStatusHikitugiFlg.Checked) return;
1663 1663

  
1664 1664
            // ???????p?t???O???N???A????
1665
            rdbStatusHikitugiFlg.Checked = false;
1665
            //rdbStatusHikitugiFlg.Checked = false;
1666 1666

  
1667 1667
            // ?f???????b?Z?[?W???????
1668 1668
            m_Transfer2MesageFlg = true;
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionBaseInfo/FrmConstructionBaseInfoAuxiliary.cs
2168 2168

  
2169 2169
                int nTargetCount = GetTargetYear();
2170 2170
                int DepartmentCode = CommonMotions.cnvInt(DepCmb.SelectedValue);
2171
                if (DepartmentCode > 0) return true;
2171 2172

  
2172 2173
                StringBuilder strSQL = new StringBuilder();
2173 2174
                CommonMotions.CreateMan2DepSQL(ref strSQL, nTargetCount, PersonCode);
......
4402 4403
                                        IORecordKey RecDB)
4403 4404
        {
4404 4405
            // ?f?[?^?Z?b?g??????p????O??????????
4405
            if (rdbStatusHikitugiFlg.Checked) return true;
4406
            //if (rdbStatusHikitugiFlg.Checked) return true;
4406 4407
            try
4407 4408
            {
4408 4409
                // ?S????I???????????
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionJoin/FrmConstructionJoin.cs
307 307
        /// <param name="e"></param>
308 308
        private void numUDConstPro_ValueChanged(object sender, EventArgs e)
309 309
        {
310
            // イベントクリア
311
            SubControlEvent();
310
            try
311
            {
312
                // イベントクリア
313
                SubControlEvent();
312 314

  
313
            // 部署コンボボックス変更
314
            SetcmbDepartment();
315
            // 担当者コンボボックス変更
316
            SetcmbPersons();
317
            // 担当者コンボボックスセット時部署をセットする
318
            if (!SetPerosonToDepartment()) return;
315
                // 部署コンボボックス変更
316
                SetcmbDepartment();
317
                // 担当者コンボボックス変更
318
                SetcmbPersons();
319
                // 担当者コンボボックスセット時部署をセットする
320
                if (!SetPerosonToDepartment()) return;
319 321

  
320
            // データ表示
321
            InitDataLoad();
322

  
323
            // イベントセット
324
            SetControlEvent();
322
                // データ表示
323
                InitDataLoad();
324
            }
325
            finally
326
            {
327
                // イベントセット
328
                SetControlEvent();
329
            }
325 330
        }
326 331
        #endregion
327 332

  
......
355 360
        /// <param name="e"></param>
356 361
        private void cmbConstructionPerson_SelectedIndexChanged(object sender, EventArgs e)
357 362
        {
358
            // イベントクリア
359
            SubControlEvent();
363
            try
364
            {
365
                // イベントクリア
366
                SubControlEvent();
360 367

  
361
            // 担当者コンボボックスセット時部署をセットする
362
            if (!SetPerosonToDepartment()) return;
368
                // 担当者コンボボックスセット時部署をセットする
369
                if (!SetPerosonToDepartment()) return;
363 370

  
364
            // データ表示
365
            InitDataLoad();
366

  
367
            // イベントセット
368
            SetControlEvent();
371
                // データ表示
372
                InitDataLoad();
373
            }
374
            finally
375
            {
376
                // イベントセット
377
                SetControlEvent();
378
            }
369 379
        }
370 380
        #endregion
371 381
    
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionJoin/FrmConstructionJoinAuxiliary.cs
340 340

  
341 341
                int nTargetCount = (int)numUDConstPro.Value;
342 342
                int DepartmentCode = GetDepartmentCode();
343
                if (DepartmentCode > 0) return true;
343 344

  
344 345
                StringBuilder strSQL = new StringBuilder();
345 346
                CommonMotions.CreateMan2DepSQL(ref strSQL, nTargetCount, PersonCode);
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedger/FrmConstructionLedgerAuxiliary.cs
4793 4793
                        return false;
4794 4794
                    }
4795 4795

  
4796
                    // 積算予算書データデータ登録
4796
                    // 工事詳細台帳経費データデータ登録
4797 4797
                    if (workList.Count == 0)
4798 4798
                    {
4799 4799
                        // データがない場合・データ登録
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedgerList/CommonLedgerData.cs
86 86
            /// 来季契約工期終了
87 87
            /// </summary>
88 88
            NextCompDate,
89
            /// <summary>
90
            /// 部署在籍開始年月日
91
            /// </summary>
92
            DepHistoryStartDate,
93
            /// <summary>
94
            /// 部署在籍終了年月日
95
            /// </summary>
96
            DepHistoryCompDate,
89 97
        }
90 98
        #endregion
91 99

  
......
104 112

  
105 113
                DateTime dtDefaultStart = CommonMotions.GetOpeningEndDate(BusinessPeriod, true);
106 114
                DateTime dtDefaultEnd = CommonMotions.GetOpeningEndDate(BusinessPeriod, false);
115
                string strdtDefSt = dtDefaultStart.ToShortDateString();
116
                string strdtDefEd = dtDefaultEnd.ToShortDateString();
107 117

  
108 118
                int nPrevYear = (BusinessPeriod - 1);
109 119
                if (nPrevYear < 0) nPrevYear = 0;
110 120
                DateTime dtPrevStart = CommonMotions.GetOpeningEndDate(nPrevYear, true);
111 121
                DateTime dtNextEnd = CommonMotions.GetOpeningEndDate((BusinessPeriod + 1), false);
112 122

  
123
                string strdtMin = DateTime.MinValue.ToShortDateString();
124
                string strdtMax = DateTime.MaxValue.ToShortDateString();
125

  
113 126
                strSQL.Append("Select");
114 127
                strSQL.Append(" DepHis.DepartmentCode");
115 128
                strSQL.Append(", Person.PersonCode");
......
122 135
                strSQL.Append(", Person.EndDate AS HireCompDays");
123 136
                strSQL.Append(", NextDetail.SDate AS NextStart");
124 137
                strSQL.Append(", NextDetail.EDate AS NextEnd");
138
                strSQL.Append(", DepHis.StartDate");
139
                strSQL.Append(", DepHis.CompDate");
140

  
125 141
                strSQL.Append(" From");
126
                strSQL.Append(" personinchargemaster As Person");
127 142

  
128
                strSQL.Append(" Left Join chgchargedep As DepHis");
143
                strSQL.Append(" (Select");
144
                strSQL.Append(" PersonCode");
145
                strSQL.Append(", DisplayOrder");
146
                strSQL.Append(", PersonName");
147
                strSQL.Append(", StartDate");
148
                strSQL.AppendFormat(", Case WHEN DATE(EndDate) = DATE('{0}') Then DATE('{1}')", strdtMin, strdtMax);
149
                strSQL.Append(" Else DATE(EndDate) End As EndDate");
150
                strSQL.Append(", EmployeeClassFlg");
151
                strSQL.Append(", LedgerFlg");
152
                strSQL.Append(", MonthlySalary");
153
                strSQL.Append(" From PERSONINCHARGEMASTER) As Person");
154

  
155
                strSQL.Append(" INNER JOIN (Select");
156
                strSQL.Append(" PersonCode");
157
                strSQL.Append(", StartDate");
158
                strSQL.AppendFormat(", Case WHEN DATE(CompDate) = DATE('{0}') Then DATE('{1}')", strdtMin, strdtMax);
159
                strSQL.Append(" Else DATE(CompDate) End As CompDate");
160
                strSQL.Append(", DepartmentCode");
161
                strSQL.Append(", DepartmentName");
162
                strSQL.Append(" From chgchargedep) As DepHis");
129 163
                strSQL.Append(" ON DepHis.PersonCode = Person.PersonCode");
130
                strSQL.AppendFormat(" AND ((DATE(DepHis.STARTDATE) <= DATE('{0}'))", dtDefaultEnd.ToShortDateString());
131
                strSQL.AppendFormat(" AND (DATE('{0}') <= DATE(DepHis.CompDate)", dtDefaultStart.ToShortDateString());
132
                strSQL.AppendFormat(" OR DATE('{0}') = DATE(DepHis.CompDate)))", DateTime.MinValue.ToShortDateString());
164
                strSQL.AppendFormat(" AND (DATE(DepHis.STARTDATE) <= DATE('{0}')", strdtDefEd);
165
                strSQL.AppendFormat(" AND DATE('{0}') <= DATE(DepHis.CompDate))", strdtDefSt);
133 166

  
134 167
                // 今期の開始終了(工事開始年月日が先期開始年月日以降を検索する)
135 168
                strSQL.Append(" Left Join");
......
161 194
                strSQL.Append("       From constructionLedgerdetail As LDetail2");
162 195
                strSQL.Append("            Inner Join constructionLedger As Ledger2");
163 196
                strSQL.Append("                  On Ledger2.ConstructionCode = LDetail2.ConstructionCode");
164
                strSQL.AppendFormat("             And DATE('{0}') <= DATE(Ledger2.Constructionstart)", dtDefaultStart.ToShortDateString());
197
                strSQL.AppendFormat("             And DATE('{0}') <= DATE(Ledger2.Constructionstart)", strdtDefSt);
165 198
                strSQL.Append("            Inner Join constructionbaseinfo As Base");
166 199
                strSQL.Append("                  On Base.ConstructionCode = LDetail2.ConstructionCode");
167 200
                strSQL.AppendFormat("            And Base.ConstructionStatusFlg <> {0}", NotOrder);
......
177 210

  
178 211
                strSQL.AppendFormat(" Where Person.LEDGERFLG = {0}", (int)PersonInChargeMaster.LedgerDivNoDef.CalcTarget);
179 212

  
180
                //if (CommonMotions.LoginUserData.PersonCode != CommonDefine.AdminCode)
181
                //{
182
                //    strSQL.Append(" AND Person.DEPARTMENTCODE IN (select PDep.DepartmentCode from PersonDepartmentMaster AS PDep");
183
                //    strSQL.AppendFormat(" WHERE PDep.PersonCode = {0})", CommonMotions.LoginUserData.PersonCode);
184
                //}
185

  
186 213
                // 工事台帳データの部署だけが対象
187 214
                if (DepartmentCode > 0)
188 215
                {
......
191 218
                }
192 219
                if (PersonCode != 0) strSQL.AppendFormat(" AND Person.PERSONCODE = {0}", PersonCode);
193 220

  
194
                strSQL.AppendFormat(" AND ((DATE(Person.STARTDATE) <= DATE('{0}'))", dtDefaultEnd.ToShortDateString());
195
                strSQL.AppendFormat(" AND (DATE('{0}') <= DATE(Person.ENDDATE)", dtDefaultStart.ToShortDateString());
196
                strSQL.AppendFormat(" OR DATE('{0}') = DATE(Person.ENDDATE)))", DateTime.MinValue.ToShortDateString());
221
                strSQL.AppendFormat(" AND (DATE(Person.STARTDATE) <= DATE('{0}')", strdtDefEd);
222
                strSQL.AppendFormat(" AND DATE('{0}') <= DATE(Person.ENDDATE))", strdtDefSt);
197 223

  
198 224
                strSQL.AppendFormat(" ORDER BY DepHis.DepartmentCode, Person.EmployeeClassFlg, Person.DISPLAYORDER");
199 225

  
......
349 375
                    strSQL.Append("          And B.GroupCount = A.GroupCount");
350 376
                    strSQL.Append("          And B.LineCount = A.LineCount");
351 377

  
352
                    if (DepartmentCode != 0)
353
                        strSQL.AppendFormat("    AND B.ComponentCode = {0}", DepartmentCode);
354
                    if (PersonCode != 0)
355
                        strSQL.AppendFormat(" AND B.CompanyCode = {0}", PersonCode);
356

  
357 378
                    strSQL.Append("   Inner Join CONSTRUCTIONBASEINFO As C");
358 379
                    strSQL.Append("          On C.ConstructionCode = A.ConstructionCode");
359 380
                    strSQL.AppendFormat("    And C.CONSTRUCTIONPERIOD = {0}", TargetYear);
......
361 382

  
362 383
                    strSQL.Append(" Where");
363 384
                    strSQL.AppendFormat("   A.GroupCount = {0}", (int)FrmConstructionLedger.DataGroup.Payroll);
385

  
386
                    if (DepartmentCode > 0)
387
                        strSQL.AppendFormat(" AND B.ComponentCode = {0}", DepartmentCode);
388
                    if (PersonCode > 0)
389
                        strSQL.AppendFormat(" AND B.CompanyCode = {0}", PersonCode);
364 390
                }
365 391
                else
366 392
                {
......
376 402
                    strSQL.Append(" Where");
377 403
                    strSQL.AppendFormat(" A.GroupCount = {0}", (int)FrmConstructionLedger.DataGroup.Payroll);
378 404

  
379
                    if (DepartmentCode != 0)
405
                    if (DepartmentCode > 0)
380 406
                        strSQL.AppendFormat(" AND A.ComponentCode = {0}", DepartmentCode);
381
                    if (PersonCode != 0)
407
                    if (PersonCode > 0)
382 408
                        strSQL.AppendFormat(" AND A.CompanyCode = {0}", PersonCode);
383 409
                }
384 410

  
......
482 508
                {
483 509
                    int nDepartmentCode = CommonMotions.cnvInt(ObjRec[(int)CommonLedgerData.GetPersonTerm.DepartmentCode]);
484 510
                    int nPersonCode = CommonMotions.cnvInt(ObjRec[(int)CommonLedgerData.GetPersonTerm.PersonCode]);
511
                    int nKeyCode = (nDepartmentCode * 100000000) + nPersonCode;
485 512
                    DateTime stDate = CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.StartDate]);
486 513
                    DateTime edDate = CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.CompDate]);
487 514

  
488
                    KeyValuePair<int, long> CurValuePair = SalDataList.Find(x => x.Key == nPersonCode);
515
                    KeyValuePair<int, long> CurValuePair = SalDataList.Find(x => x.Key == nKeyCode);
489 516

  
490 517
                    // 配列セット
491 518
                    ArrarySalary.Add(new SalaryClass(nDepartmentCode, nPersonCode, (int)CurValuePair.Value, stDate, edDate));
......
498 525
        }
499 526
        #endregion
500 527

  
528
        #region 期間データ配列より対象となる担当者データのインデックスを取得する
529
        /// <summary>
530
        /// 期間データ配列より対象となる担当者のデータのインデックスを取得する
531
        /// </summary>
532
        public static int GetTargetPersonRec(ArrayList TargetList, int nDepCode, int nPersonCode)
533
        {
534
            try
535
            {
536
                int nindex = 0;
537
                foreach(object[] wrkRec in TargetList)
538
                {
539
                    int wrkDep = CommonMotions.cnvInt(wrkRec[(int)GetPersonTerm.DepartmentCode]);
540
                    int wrkManNo = CommonMotions.cnvInt(wrkRec[(int)GetPersonTerm.PersonCode]);
541

  
542
                    if(nDepCode == wrkDep && nPersonCode == wrkManNo)
543
                    {
544
                        return nindex;
545
                    }
546
                    nindex++;
547
                }
548
                return -1;
549
            }
550
            catch (Exception ex)
551
            {
552
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
553
                return -1;
554
            }
555
        }
556
        #endregion
557

  
501 558
        #region 担当者毎割当無費目毎の経費を一括取得する
502 559
        /// <summary>
503 560
        /// 担当者毎割当無費目毎の経費を一括取得する
504 561
        /// </summary>
505 562
        public static void GetPersonExpensesCostValueAll(IOCostDataOfPerson CostDB,
506 563
                                                        int nNowYear,
564
                                                        ArrayList TargetList,
507 565
                                                        List<SalaryClass> ArrarySalary,
508 566
                                                        ref List<PersonExpensesCost> CostValue)
509 567
        {
......
518 576
                StringBuilder strSQL = new StringBuilder();
519 577
                foreach (SalaryClass CurData in ArrarySalary)
520 578
                {
521
                    if(!bFirst) strSQL.Append(" UNION ");
579

  
580
                    string strDtSt = dtDefaultStart.ToShortDateString();
581
                    string strDtEd = dtDefaultEnd.ToShortDateString();
582
                    // 対象者の期間データを取得する
583
                    int nRecIdx = GetTargetPersonRec(TargetList, CurData.DepartmentCode, CurData.PersonCode);
584
                    if (nRecIdx > -1)
585
                    {
586
                        object[] wrkCur = (object[])TargetList[nRecIdx];
587
                        DateTime dtStart = CommonMotions.cnvDate(wrkCur[(int)GetPersonTerm.DepHistoryStartDate]);
588
                        DateTime dtComp = CommonMotions.cnvDate(wrkCur[(int)GetPersonTerm.DepHistoryCompDate]);
589

  
590
                        if (dtDefaultStart.Date <= dtStart.Date && dtStart.Date <= dtDefaultEnd)
591
                        {
592
                            strDtSt = dtStart.ToShortDateString();
593
                        }
594
                        if (dtDefaultStart.Date <= dtComp.Date && dtComp.Date <= dtDefaultEnd)
595
                        {
596
                            strDtEd = dtComp.ToShortDateString();
597
                        }
598
                    }
599

  
600
                    if (!bFirst) strSQL.Append(" UNION ");
522 601
                    strSQL.Append("SELECT");
523
                    strSQL.Append(" PERSONCODE");
602
                    if (nRecIdx > -1)
603
                    {
604
                        object[] wrkCur = (object[])TargetList[nRecIdx];
605
                        strSQL.AppendFormat(" {0}", CommonMotions.cnvInt(wrkCur[0]));
606
                    }
607
                    strSQL.Append(", PERSONCODE");
524 608
                    strSQL.Append(", B.DATATYPE AS DATATYPE");
525 609
                    strSQL.Append(", SUM(B.ENTRYPRICE) AS SUMPRICE");
526 610
                    strSQL.Append(" FROM");
......
529 613

  
530 614
                    strSQL.AppendFormat(" B.PERSONCODE = {0}", CurData.PersonCode);
531 615

  
532
                    strSQL.AppendFormat(" AND (DATE('{0}') <= DATE(B.ACTIONDATE)", dtDefaultStart.ToShortDateString());
533
                    strSQL.AppendFormat(" AND DATE(B.ACTIONDATE) <= DATE('{0}'))", dtDefaultEnd.ToShortDateString());
616
                    strSQL.AppendFormat(" AND (DATE('{0}') <= DATE(B.ACTIONDATE)", strDtSt);
617
                    strSQL.AppendFormat(" AND DATE(B.ACTIONDATE) <= DATE('{0}'))", strDtEd);
534 618
                    strSQL.Append(" AND B.CONSTRUCTIONCODE = 0");
535 619
                    strSQL.Append(" GROUP BY B.DATATYPE");
536 620

  
......
552 636
                                    ; i <= (int)CostDataOfPerson.DataNoDef.DisposalCost
553 637
                                    ; i++)
554 638
                        {
555
                            GetCostVal[i] = arList.Cast<object[]>().Where(x => CommonMotions.cnvInt(x[0]) == CurData.PersonCode
556
                                                                            && CommonMotions.cnvInt(x[1]) == i)
557
                                                                    .Sum(y => CommonMotions.cnvInt(y[2]));
639
                            GetCostVal[i] = arList.Cast<object[]>().Where(x => CommonMotions.cnvInt(x[0]) == CurData.DepartmentCode
640
                                                                            && CommonMotions.cnvInt(x[1]) == CurData.PersonCode
641
                                                                            && CommonMotions.cnvInt(x[2]) == i)
642
                                                                    .Sum(y => CommonMotions.cnvInt(y[3]));
558 643
                        }
559 644
                    }
560 645

  
......
562 647
                                                            , CurData.PersonCode
563 648
                                                            , CurData.StartDate
564 649
                                                            , CurData.CompDate
565
                                                            , new int[] { GetCostVal[0], GetCostVal[1], GetCostVal[2],
566
                                                                                GetCostVal[3],GetCostVal[4],GetCostVal[5],
567
                                                                                GetCostVal[6] }));
650
                                                            , new int[] { GetCostVal[0],            // Dummy
651
                                                                            GetCostVal[1], GetCostVal[2], GetCostVal[3],
652
                                                                            GetCostVal[4], GetCostVal[5], GetCostVal[6] }));
568 653
                }
569 654
            }
570 655
            catch (Exception ex)
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedgerList/FrmConstructionLedgerList.cs
665 665
        /// <param name="e"></param>
666 666
        private void numUDConstPro_ValueChanged(object sender, EventArgs e)
667 667
        {
668
            // ?C?x???g?N???A
669
            SubControlEvent();
668
            try
669
            {
670
                // ?C?x???g?N???A
671
                SubControlEvent();
670 672

  
671
            // ???N???A
672
            ClearDisplay();
673
                // ???N???A
674
                ClearDisplay();
673 675

  
674
            // ?S????R???{?{?b?N?X?Z?b?g?????????Z?b?g????
675
            if (!SetPerosonToDepartment()) return;
676
                // ?S????R???{?{?b?N?X?Z?b?g?????????Z?b?g????
677
                if (!SetPerosonToDepartment()) return;
676 678

  
677
            // ?f?[?^?\??
678
            DataDisplay();
679
                // ?f?[?^?\??
680
                DataDisplay();
679 681

  
680
            // ?C?x???g?Z?b?g
681
            SetControlEvent();
682
            }
683
            finally
684
            {
685
                // ?C?x???g?Z?b?g
686
                SetControlEvent();
687
            }
682 688
        }
683 689
        #endregion
684 690

  
......
715 721
        /// <param name="e"></param>
716 722
        private void cmbConstructionPerson_SelectedIndexChanged(object sender, EventArgs e)
717 723
        {
718
            // ?C?x???g?N???A
719
            SubControlEvent();
724
            try
725
            {
726
                // ?C?x???g?N???A
727
                SubControlEvent();
720 728

  
721
            // ???N???A
722
            ClearDisplay();
729
                // ???N???A
730
                ClearDisplay();
723 731

  
724
            // ?S????R???{?{?b?N?X?Z?b?g?????????Z?b?g????
725
            if (!SetPerosonToDepartment()) return;
732
                // ?S????R???{?{?b?N?X?Z?b?g?????????Z?b?g????
733
                if (!SetPerosonToDepartment()) return;
726 734

  
727
            // ????????????N????S?????X???p?????[?^??X
728
            if (!m_FirstStartFlg)
735
                // ????????????N????S?????X???p?????[?^??X
736
                if (!m_FirstStartFlg)
737
                {
738
                    m_FirstStartPersonCode = CommonMotions.cnvInt(cmbConstructionPerson.SelectedValue);
739
                }
740

  
741
                // ?f?[?^?\??
742
                DataDisplay();
743
            }
744
            finally
729 745
            {
730
                m_FirstStartPersonCode = CommonMotions.cnvInt(cmbConstructionPerson.SelectedValue);
746
                // ?C?x???g?Z?b?g
747
                SetControlEvent();
731 748
            }
732

  
733
            // ?f?[?^?\??
734
            DataDisplay();
735

  
736
            // ?C?x???g?Z?b?g
737
            SetControlEvent();
738 749
        }
739 750
        #endregion
740 751

  
......
822 833

  
823 834
            // ?f?[?^??????????????
824 835
            if (dgv.RowCount == 0) return;
825
            if (CommonMotions.chkCellBlank(CurRow.Cells[(int)DCFirstHalf.SelectionCode].Value) &&
826
                CommonMotions.chkCellBlank(CurRow.Cells[(int)DCFirstHalf.SelectionName].Value))
836

  
837
            // ???v?s??????????
838
            string strWork = CommonMotions.cnvString(CurRow.Cells[(int)DCFirstHalf.SelectionName].Value);
839
            bool bTitle = false;
840
            foreach (string strTitle in s_TotalTitleArray)
827 841
            {
828
                return;
829
            }
830
            else
831
            {
832
                // ???v?s??????????
833
                string strWork = CommonMotions.cnvString(CurRow.Cells[(int)DCFirstHalf.SelectionName].Value);
834
                bool bTitle = false;
835
                foreach (string strTitle in s_TotalTitleArray)
842
                if (strWork.Equals(strTitle))
836 843
                {
837
                    if (strWork.Equals(strTitle))
838
                    {
839
                        bTitle = true;
840
                        break;
841
                    }
844
                    bTitle = true;
845
                    break;
842 846
                }
843
                if (bTitle) return;
844 847
            }
848

  
845 849
            // ?s?I??F????????
846 850
            if (m_BeforeGridRow >= 0) DefaultRowChangeColor(m_BeforeGridRow);
847 851

  
848
            // ?I???s??????
849
            m_BeforeGridRow = dgv.CurrentRow.Index;
850
            // ?s?I??F????
851
            SelectRowChangeColor(m_BeforeGridRow);
852
            if (!bTitle)
853
            {
854
                // ?I???s??????
855
                m_BeforeGridRow = dgv.CurrentRow.Index;
856
                // ?s?I??F????
857
                SelectRowChangeColor(m_BeforeGridRow);
858
            }
852 859
        }
853 860
        #endregion
854 861

  
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedgerList/FrmConstructionLedgerListAuxiliary.cs
725 725
        }
726 726
        #endregion
727 727

  
728
        #region ???S????^?w????????^????????
728
        #region ???^????????
729 729
        /// <summary>
730
        /// ???S????^?w????????^????????
730
        /// ???^????????
731 731
        /// </summary>
732 732
        private int SetAuxiliaryCost(IOConstructionLedger LedgerDB)
733 733
        {
......
1041 1041

  
1042 1042
                // ????o?????????
1043 1043
                List<PersonExpensesCost> ArraryCost = new List<PersonExpensesCost>();
1044
                CommonLedgerData.GetPersonExpensesCostValueAll(CostDB, (int)numUDConstPro.Value, ArrarySalary, ref ArraryCost);
1044
                CommonLedgerData.GetPersonExpensesCostValueAll(CostDB, (int)numUDConstPro.Value, TargetList, ArrarySalary, ref ArraryCost);
1045 1045

  
1046 1046
                // ProgressBar??l???X????
1047 1047
                prgber.Value++;
......
1173 1173
        {
1174 1174
            try
1175 1175
            {
1176
                string strdtMin = DateTime.MinValue.ToShortDateString();
1177
                string strdtMax = DateTime.MaxValue.ToShortDateString();
1178

  
1179
                int nTargetYear = (int)numUDConstPro.Value;
1180
                // ?????J?n?I???N????
1181
                DateTime dtDefaultStart = CommonMotions.GetOpeningEndDate(nTargetYear, true);
1182
                DateTime dtDefaultEnd = CommonMotions.GetOpeningEndDate(nTargetYear, false);
1183
                // ???E????N????
1184
                string strdtStart = dtDefaultStart.ToShortDateString();
1185
                string strdtEnd = dtDefaultEnd.ToShortDateString();
1186

  
1176 1187
                // SQL??A?N?Z?X????????????
1177 1188
                StringBuilder strSecurity = new StringBuilder();
1178 1189
                CreateSecuritySQL(ref strSecurity);
......
1191 1202
                strSQL.Append(", C.PERSONNAME");
1192 1203
                strSQL.Append(", B.DETAILSTRING");
1193 1204
                strSQL.Append(", A.ORDERSDECISIONPRICE");
1194
                //strSQL.Append(", A.COMPANYEXPENSES");
1195
                //strSQL.Append(", A.DEPARTMENTEXPENSES");
1196
                //strSQL.Append(", A.SALESEXPENSES");
1197 1205
                strSQL.Append(", A.TOTALPAYMENT");
1198 1206
                strSQL.Append(", A.GROSSPROFIT");
1199 1207
                strSQL.Append(", A.ALLOWANCE");
......
1202 1210
                strSQL.Append(", E.DISPLAYORDER");
1203 1211
                strSQL.Append(", C.DISPLAYORDER");
1204 1212
                strSQL.Append(", C.DEPARTMENTCODE");
1205
                strSQL.Append(", ifnull(F.DetailString, '')");
1213
                strSQL.Append(", ifnull(I.DepartmentName, '')");
1206 1214
                strSQL.Append(", D.CONSTRUCTIONSTATUSFLG");
1207 1215

  
1208 1216
                strSQL.Append(", G.SeqNo As ExpSeqNo");
......
1220 1228
                strSQL.AppendFormat(" ON H.DivisionCode = {0}",(int)DivisionMaster.DivisionMasterCodeDef.ConstructionExpenses);
1221 1229
                strSQL.Append("       And H.NameCode = G.NameCode");
1222 1230

  
1223
                strSQL.Append(" INNER JOIN CONSTRUCTIONBASEINFO AS D");
1231
                strSQL.Append(" LEFT JOIN CONSTRUCTIONBASEINFO AS D");
1224 1232
                strSQL.Append("       ON A.CONSTRUCTIONCODE = D.CONSTRUCTIONCODE");
1233
                if (DepartmentCode > 0)
1234
                {
1235
                    strSQL.AppendFormat("       AND D.ConstrDepCode = {0}", DepartmentCode);
1236
                }
1225 1237
                strSQL.AppendFormat(" AND D.TyingFlg != {0}", (int)ConstructionBaseInfo.TyingFlgDef.Tying);
1226
                strSQL.AppendFormat(" AND D.CONSTRUCTIONPERIOD = {0}", numUDConstPro.Value);
1238
                strSQL.AppendFormat(" AND D.CONSTRUCTIONPERIOD = {0}", nTargetYear);
1227 1239
                strSQL.AppendFormat(" AND D.CONSTRUCTIONSTATUSFLG != {0}", NotOrder);
1228 1240

  
1229 1241
                strSQL.Append(" LEFT JOIN CONSTRUCTIONBASEINFODETAIL AS B");
1230 1242
                strSQL.Append("       ON A.CONSTRUCTIONCODE = B.CONSTRUCTIONCODE");
1231 1243
                strSQL.AppendFormat(" AND B.DETAILNO = {0}", (int)ConstructionBaseInfoDetail.DataNoDef.ConstructionName);
1232 1244

  
1245
                strSQL.Append(" Inner Join(Select H.PersonCode, H.StartDate");
1246
                strSQL.AppendFormat("         , Case WHEN DATE(H.CompDate) = DATE('{0}') Then DATE('{1}')", strdtMin, strdtMax);
1247
                strSQL.Append("                      Else DATE(H.CompDate) End As CompDate");
1248
                strSQL.Append("               , H.DepartmentCode, H.DepartmentName");
1249
                strSQL.Append("            From chgchargedep As H) As I");
1250
                strSQL.Append("       On I.PersonCode = D.ConstructionPersonCode");
1251
                strSQL.AppendFormat(" And(DATE(I.StartDate) <= DATE('{0}')", strdtEnd);
1252
                strSQL.AppendFormat(" And DATE('{0}') <= DATE(I.CompDate))", strdtStart);
1253

  
1233 1254
                strSQL.Append(" LEFT JOIN CONSTRUCTIONBASEINFODETAIL AS F");
1234 1255
                strSQL.Append("       On F.ConstructionCode = A.ConstructionCode");
1235 1256
                strSQL.AppendFormat(" And F.DetailNo = {0}", (int)ConstructionBaseInfoDetail.DataNoDef.ConstrDepartmentName);
......
1243 1264
                if (strSecurity.Length > 0) strSQL.Append(strSecurity.ToString());
1244 1265
                if (DepartmentCode > 0)
1245 1266
                {
1246
                    strSQL.AppendFormat(" AND (D.ConstrDepCode = {0}", DepartmentCode);
1247
                    strSQL.AppendFormat(" AND F.DetailString = '{0}')", cmbDepartment.Text);
1267
                    strSQL.AppendFormat(" AND I.DepartmentCode = {0}", DepartmentCode);
1248 1268
                }
1249 1269
                if (PersonCode > 0)
1250 1270
                {
......
1726 1746

  
1727 1747
                int nTargetCount = (int)numUDConstPro.Value;
1728 1748
                int DepartmentCode = GetDepartmentCode();
1749
                if (DepartmentCode > 0) return true;
1729 1750

  
1730 1751
                StringBuilder strSQL = new StringBuilder();
1731 1752
                CommonMotions.CreateMan2DepSQL(ref strSQL, nTargetCount, PersonCode);
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionSplit/FrmConstructionSplit.cs
198 198
        /// <param name="e"></param>
199 199
        private void numUDConstPro_ValueChanged(object sender, EventArgs e)
200 200
        {
201
            // イベントクリア
202
            SubControlEvent();
201
            try
202
            {
203
                // イベントクリア
204
                SubControlEvent();
203 205

  
204
            // 部署コンボボックス変更
205
            SetcmbDepartment();
206
            // 担当者コンボボックス変更
207
            SetcmbPersons();
208
            // 担当者コンボボックスセット時部署をセットする
209
            if (!SetPerosonToDepartment()) return;
206
                // 部署コンボボックス変更
207
                SetcmbDepartment();
208
                // 担当者コンボボックス変更
209
                SetcmbPersons();
210
                // 担当者コンボボックスセット時部署をセットする
211
                if (!SetPerosonToDepartment()) return;
210 212

  
211
            // データ表示
212
            InitDataLoad();
213

  
214
            // イベントセット
215
            SetControlEvent();
213
                // データ表示
214
                InitDataLoad();
215
            }
216
            finally
217
            {
218
                // イベントセット
219
                SetControlEvent();
220
            }
216 221
        }
217 222
        #endregion
218 223

  
......
246 251
        /// <param name="e"></param>
247 252
        private void cmbConstructionPerson_SelectedIndexChanged(object sender, EventArgs e)
248 253
        {
249
            // イベントクリア
250
            SubControlEvent();
254
            try
255
            {
256
                // イベントクリア
257
                SubControlEvent();
251 258

  
252
            // 担当者コンボボックスセット時部署をセットする
253
            if (!SetPerosonToDepartment()) return;
259
                // 担当者コンボボックスセット時部署をセットする
260
                if (!SetPerosonToDepartment()) return;
254 261

  
255
            // データ表示
256
            InitDataLoad();
257

  
258
            // イベントセット
259
            SetControlEvent();
262
                // データ表示
263
                InitDataLoad();
264
            }
265
            finally
266
            {
267
                // イベントセット
268
                SetControlEvent();
269
            }
260 270
        }
261 271
        #endregion
262 272
    }
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionSplit/FrmConstructionSplitAuxiliary.cs
338 338

  
339 339
                int nTargetCount = (int)numUDConstPro.Value;
340 340
                int DepartmentCode = GetDepartmentCode();
341
                if (DepartmentCode > 0) return true;
341 342

  
342 343
                StringBuilder strSQL = new StringBuilder();
343 344
                CommonMotions.CreateMan2DepSQL(ref strSQL, nTargetCount, PersonCode);
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/CopyTargetList/FrmCopyTargetList.cs
260 260
        /// <param name="e"></param>
261 261
        private void numUDConstPro_ValueChanged(object sender, EventArgs e)
262 262
        {
263
            // ?C?x???g?N???A
264
            SubControlEvent();
263
            try
264
            {
265
                // ?C?x???g?N???A
266
                SubControlEvent();
265 267

  
266
            // ?????R???{?{?b?N?X??X
267
            SetcmbDepartment();
268
            // ?S????R???{?{?b?N?X??X
269
            SetcmbPersons();
270
            // ?S????R???{?{?b?N?X?Z?b?g?????????Z?b?g????
271
            if (!SetPerosonToDepartment()) return;
268
                // ?????R???{?{?b?N?X??X
269
                SetcmbDepartment();
270
                // ?S????R???{?{?b?N?X??X
271
                SetcmbPersons();
272
                // ?S????R???{?{?b?N?X?Z?b?g?????????Z?b?g????
273
                if (!SetPerosonToDepartment()) return;
272 274

  
273
            // ?f?[?^?\??
274
            DataDisplay();
275

  
276
            // ?C?x???g?Z?b?g
277
            SetControlEvent();
275
                // ?f?[?^?\??
276
                DataDisplay();
277
            }
278
            finally
279
            {
280
                // ?C?x???g?Z?b?g
281
                SetControlEvent();
282
            }
278 283
        }
279 284
        #endregion
280 285

  
......
308 313
        /// <param name="e"></param>
309 314
        private void cmbConstructionPerson_SelectedIndexChanged(object sender, EventArgs e)
310 315
        {
311
            // ?C?x???g?N???A
312
            SubControlEvent();
316
            try
317
            {
318
                // ?C?x???g?N???A
319
                SubControlEvent();
313 320

  
314
            // ?S????R???{?{?b?N?X?Z?b?g?????????Z?b?g????
315
            if (!SetPerosonToDepartment()) return;
321
                // ?S????R???{?{?b?N?X?Z?b?g?????????Z?b?g????
322
                if (!SetPerosonToDepartment()) return;
316 323

  
317
            // ?f?[?^?\??
318
            DataDisplay();
319

  
320
            // ?C?x???g?Z?b?g
321
            SetControlEvent();
324
                // ?f?[?^?\??
325
                DataDisplay();
326
            }
327
            finally
328
            {
329
                // ?C?x???g?Z?b?g
330
                SetControlEvent();
331
            }
322 332
        }
323 333
        #endregion
324 334

  
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/CopyTargetList/FrmCopyTargetListAuxiliary.cs
806 806

  
807 807
                int nTargetCount = (int)numUDConstPro.Value;
808 808
                int DepartmentCode = GetDepartmentCode();
809
                if (DepartmentCode > 0) return true;
809 810

  
810 811
                StringBuilder strSQL = new StringBuilder();
811 812
                CommonMotions.CreateMan2DepSQL(ref strSQL, nTargetCount, PersonCode);
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/CostomerRegist/FrmCostomerRegist.cs
333 333
            }
334 334

  
335 335
            // 承認画面の「承認対象データを見る」からの起動時は承認ボタンの表示がある
336
            bool bApproval = ClsApprovalPermission.ExceApprovalScreen((int)ClsExcute.SubFormExecuteNo.ApprovalPerson);
336
            bool bApproval = ClsApprovalPermission.ExceApprovalScreen();
337 337
            if (bApproval)
338 338
            {
339 339
                // 承認対象コードを取得する
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/CostomerRegist/FrmCostomerRegistAuxiliary.cs
208 208
                int iApprovalCode = ClsExcute.AppovalList.First(x => x.Value.Equals(s_MyProcessName)).Key;
209 209

  
210 210
                // 起動元のリストに承認画面があれば表示しない
211
                if (ClsApprovalPermission.ExceApprovalScreen((int)ClsExcute.SubFormExecuteNo.ApprovalPerson))
211
                if (ClsApprovalPermission.ExceApprovalScreen())
212 212
                {
213 213
                    pnlApproval.Visible = false;
214 214
                }
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/CostomerRegist/FrmCostomerRegistList.cs
267 267
        /// <param name="e"></param>
268 268
        private void numUDConstPro_ValueChanged(object sender, EventArgs e)
269 269
        {
270
            // ?C?x???g?N???A
271
            SubControlEvent();
270
            try
271
            {
272
                // ?C?x???g?N???A
273
                SubControlEvent();
272 274

  
273
            // ?????R???{?{?b?N?X??X
274
            SetcmbDepartment();
275
            // ?S????R???{?{?b?N?X??X
276
            SetcmbPersons();
277
            // ?S????R???{?{?b?N?X?Z?b?g?????????Z?b?g????
278
            if (!SetPerosonToDepartment()) return;
275
                // ?????R???{?{?b?N?X??X
276
                SetcmbDepartment();
277
                // ?S????R???{?{?b?N?X??X
278
                SetcmbPersons();
279
                // ?S????R???{?{?b?N?X?Z?b?g?????????Z?b?g????
280
                if (!SetPerosonToDepartment()) return;
279 281

  
280
            // ?f?[?^?\??
281
            DataDisplay();
282

  
283
            // ?C?x???g?Z?b?g
284
            SetControlEvent();
282
                // ?f?[?^?\??
283
                DataDisplay();
284
            }
285
            finally
286
            {
287
                // ?C?x???g?Z?b?g
288
                SetControlEvent();
289
            }
285 290
        }
286 291
        #endregion
287 292

  
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/CostomerRegist/FrmCostomerRegistListAuxiliary.cs
767 767

  
768 768
                int nTargetCount = (int)numUDConstPro.Value;
769 769
                int DepartmentCode = GetDepartmentCode();
770
                if (DepartmentCode > 0) return true;
770 771

  
771 772
                StringBuilder strSQL = new StringBuilder();
772 773
                CommonMotions.CreateMan2DepSQL(ref strSQL, nTargetCount, PersonCode);
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/DRList/FrmDRList.cs
319 319
        /// <param name="e"></param>
320 320
        private void cmbPerson_SelectedIndexChanged(object sender, EventArgs e)
321 321
        {
322
            // ?C?x???g?N???A
323
            SubControlEvent();
322
            try
323
            {
324
                // ?C?x???g?N???A
325
                SubControlEvent();
324 326

  
325
            // ?S????I?????????I????????
326
            if (!SetPerosonToDepartment()) return;
327
                // ?S????I?????????I????????
328
                if (!SetPerosonToDepartment()) return;
327 329

  
328
            // ?f?[?^?\??
329
            DataDisplay();
330

  
331
            // ?C?x???g?Z?b?g
332
            SetControlEvent();
330
                // ?f?[?^?\??
331
                DataDisplay();
332
            }
333
            finally
334
            {
335
                // ?C?x???g?Z?b?g
336
                SetControlEvent();
337
            }
333 338
        }
334 339
        #endregion
335 340

  
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/DRList/FrmDRListAuxiliary.cs
1006 1006

  
1007 1007
                int nTargetCount = (int)numUDConstPro.Value;
1008 1008
                int DepartmentCode = GetDepartmentCode();
1009
                if (DepartmentCode > 0) return true;
1009 1010

  
1010 1011
                StringBuilder strSQL = new StringBuilder();
1011 1012
                CommonMotions.CreateMan2DepSQL(ref strSQL, nTargetCount, PersonCode);
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/DRWork/FrmDRWork.cs
325 325
                }
326 326

  
327 327
                // 承認画面の「承認対象データを見る」からの起動時は承認ボタンの表示がある
328
                bool bApproval = ClsApprovalPermission.ExceApprovalScreen((int)ClsExcute.SubFormExecuteNo.ApprovalPerson);
328
                bool bApproval = ClsApprovalPermission.ExceApprovalScreen();
329 329
                if (bApproval)
330 330
                {
331 331
                    // 承認対象コードを取得する
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/DRWork/FrmDRWorkAuxiliary.cs
1119 1119
                if (!cmbConstructionPerson.Visible && PersonCode < 1) return false;
1120 1120

  
1121 1121
                int DepartmentCode = CommonMotions.cnvInt(cmbDepartment.SelectedValue);
1122
                if (DepartmentCode > 0) return true;
1122 1123

  
1123 1124
                string strSQL = PersonDB.CreatePrimarykeyString(PersonCode);
1124 1125
                PersonInChargeMaster PersonRec = new PersonInChargeMaster();
......
2091 2092
                int iApprovalCode = ClsExcute.AppovalList.First(x => x.Value.Equals(s_MyProcessName)).Key;
2092 2093

  
2093 2094
                // 起動元のリストに承認画面があれば表示しない
2094
                if (ClsApprovalPermission.ExceApprovalScreen((int)ClsExcute.SubFormExecuteNo.ApprovalPerson))
2095
                if (ClsApprovalPermission.ExceApprovalScreen())
2095 2096
                {
2096 2097
                    pnlApproval.Visible = false;
2097 2098
                }
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/DepExpenssList/FrmDepExpenssList.cs
442 442

  
443 443
            // ?f?[?^??????????????
444 444
            if (dgv.RowCount == 0) return;
445
            if (CommonMotions.chkCellBlank(CurRow.Cells[(int)DCFirstHalf.SelectionCode].Value) &&
446
                CommonMotions.chkCellBlank(CurRow.Cells[(int)DCFirstHalf.SelectionName].Value))
445
            // ???v?s??????????
446
            string strWork = CommonMotions.cnvString(CurRow.Cells[(int)DCFirstHalf.SelectionName].Value);
447
            bool bTitle = false;
448
            foreach (string strTitle in s_TotalTitleArray)
447 449
            {
448
                return;
449
            }
450
            else
451
            {
452
                // ???v?s??????????
453
                string strWork = CommonMotions.cnvString(CurRow.Cells[(int)DCFirstHalf.SelectionName].Value);
454
                bool bTitle = false;
455
                foreach (string strTitle in s_TotalTitleArray)
450
                if (strWork.Equals(strTitle))
456 451
                {
457
                    if (strWork.Equals(strTitle))
458
                    {
459
                        bTitle = true;
460
                        break;
461
                    }
452
                    bTitle = true;
453
                    break;
462 454
                }
463
                if (bTitle) return;
464 455
            }
456

  
465 457
            // ?s?I??F????????
466 458
            if (m_BeforeGridRow >= 0) DefaultRowChangeColor(m_BeforeGridRow);
467 459

  
468
            // ?I???s??????
469
            m_BeforeGridRow = dgv.CurrentRow.Index;
470
            // ?s?I??F????
471
            SelectRowChangeColor(m_BeforeGridRow);
460
            if (!bTitle)
461
            {
462
                // ?I???s??????
463
                m_BeforeGridRow = dgv.CurrentRow.Index;
464
                // ?s?I??F????
465
                SelectRowChangeColor(m_BeforeGridRow);
466
            }
472 467
        }
473 468
        #endregion
474 469

  
......
492 487
        /// <param name="e"></param>
493 488
        private void numUDConstPro_ValueChanged(object sender, EventArgs e)
494 489
        {
495
            // ?C?x???g?N???A
496
            SubControlEvent();
490
            try
491
            {
492
                // ?C?x???g?N???A
493
                SubControlEvent();
497 494

  
498
            // ???N???A
499
            ClearDisplay();
495
                // ???N???A
496
                ClearDisplay();
500 497

  
501
            // ?????R???{?{?b?N?X??X
502
            SetcmbDepartment();
498
                // ?????R???{?{?b?N?X??X
499
                SetcmbDepartment();
503 500

  
504
            // ?f?[?^?\??
505
            DataDisplay();
501
                // ?f?[?^?\??
502
                DataDisplay();
506 503

  
507
            // ?C?x???g?Z?b?g
508
            SetControlEvent();
504
            }
505
            finally
506
            {
507
                // ?C?x???g?Z?b?g
508
                SetControlEvent();
509
            }
509 510
        }
510 511
        #endregion
511 512

  
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/DepExpenssList/FrmDepExpenssListAuxiliary.cs
324 324
                DataGridViewEX dgv = dgvMaster;
325 325

  
326 326
                // ???f?[?^????????
327
                var SumData = arData.Cast<object[]>().Max(y => CommonMotions.cnvLong(y[(int)DBGetData.OrdersDecisionprice]));
327
                //var SumData = arData.Cast<object[]>().Max(y => CommonMotions.cnvLong(y[(int)DBGetData.OrdersDecisionprice]));
328 328
                ArrayList ArrayData = new ArrayList();
329 329
                object[] objwrk = null;
330 330
                long MaxOrder = -1;
331 331
                foreach (object[] ObjRec in arData)
332 332
                {
333
                    // ???R?[?h?????R?[?h
333 334
                    int wrkCode = CommonMotions.cnvInt(ObjRec[(int)DBGetData.DepartmentCode]);
334 335
                    if (wrkCode != ExecCode) continue;
336

  
335 337
                    ArrayData.Add(ObjRec);
338

  
336 339
                    // ????z????????????c??
337 340
                    long wrkOrder = CommonMotions.cnvLong(ObjRec[(int)DBGetData.OrdersDecisionprice]);
338 341
                    if (MaxOrder < wrkOrder)
......
351 354
                    wrkArray[i] = CommonMotions.cnvInt(objwrk[i]);
352 355
                }
353 356
                // ------ ?????R?[?h?E?S????R?[?h??
354
                int DepartmentCode = 0;
357
                int DepartmentCode = GetDepartmentCode();
355 358
                int PersonCode = 0;
356
                if (GetDepartmentCode() == 0)
359

  
360
                if (DepartmentCode == 0)
357 361
                {   // ??????????????f?[?^?????????
358 362
                    DepartmentCode = CommonMotions.cnvInt(objwrk[(int)DBGetData.DepartmentCode]);
359 363
                }
360 364
                else
361 365
                {   // ???????????S????R?[?h???f?[?^????????
362
                    DepartmentCode = GetDepartmentCode();
363 366
                    PersonCode = CommonMotions.cnvInt(objwrk[(int)DBGetData.DepartmentCode]);
364 367
                }
365 368
                // ------------------------------------------------------------------------------------------
......
375 378
                if (PersonCode == 0)
376 379
                {
377 380
                    int CurPersonCode = 0;
381
                    int nDepCode = 0;
378 382
                    foreach (object[] ObjRec in TargetList)
379 383
                    {
380
                        int nDepCode = CommonMotions.cnvInt(ObjRec[(int)CommonLedgerData.GetPersonTerm.DepartmentCode]);
384
                        nDepCode = CommonMotions.cnvInt(ObjRec[(int)CommonLedgerData.GetPersonTerm.DepartmentCode]);
381 385
                        if (nDepCode != DepartmentCode) continue;
382 386

  
383 387
                        CurPersonCode = CommonMotions.cnvInt(ObjRec[(int)CommonLedgerData.GetPersonTerm.PersonCode]);
384 388
                        // ?o???
385
                        PersonExpensesCost[] GetCostList = ArraryCost.Where(x => x.PersonCode == CurPersonCode).ToArray();
389
                        PersonExpensesCost[] GetCostList = ArraryCost.Where(x => x.DepartmentCode == DepartmentCode
390
                                                                                && x.PersonCode == CurPersonCode)
391
                                                                        .ToArray();
386 392
                        foreach (PersonExpensesCost CurCostRec in GetCostList)
387 393
                        {
388 394
                            CostValue += CurCostRec.CostValue.Sum();
389 395
                        }
390 396
                    }
391 397
                    // ???^????
392
                    TotalSalary += ArrarySalary.Where(x => x.DepartmentCode == DepartmentCode).Sum(y => y.SalaryValue);
398
                    TotalSalary += ArrarySalary.Where(x => x.DepartmentCode == DepartmentCode)
399
                                                .Sum(y => y.SalaryValue);
393 400

  
394 401
                    // ?U?????^???z
395 402
                    CommonLedgerData.ProfitGeneral(LedgerDB, TargetYear, DepartmentCode, 0, ref OnSalary);
......
409 416
                    if (ObjCur == null) return;
410 417

  
411 418
                    // ?o???
412
                    PersonExpensesCost[] GetCostList = ArraryCost.Where(x => x.PersonCode == PersonCode).ToArray();
419
                    PersonExpensesCost[] GetCostList = ArraryCost.Where(x => x.DepartmentCode == DepartmentCode
420
                                                                                && x.PersonCode == PersonCode)
421
                                                                    .ToArray();
413 422
                    foreach (PersonExpensesCost CurCostRec in GetCostList)
414 423
                    {
415 424
                        CostValue += CurCostRec.CostValue.Sum();
416 425
                    }
417 426
                    // ???^????
418
                    TotalSalary = ArrarySalary.Where(x => x.PersonCode == PersonCode).Sum(y => y.SalaryValue);
427
                    TotalSalary = ArrarySalary.Where(x => x.DepartmentCode == DepartmentCode
428
                                                        && x.PersonCode == PersonCode)
429
                                                .Sum(y => y.SalaryValue);
419 430

  
420 431
                    // ?U?????^???z
421 432
                    CommonLedgerData.ProfitGeneral(LedgerDB, TargetYear, DepartmentCode, PersonCode, ref OnSalary);
... 差分の行数が表示可能な上限を超えました。超過分は表示しません。

他の形式にエクスポート: Unified diff