プロジェクト

全般

プロフィール

リビジョン 343

堀内6年以上前に追加

工事承認処理:承認後さらに承認できてしまうバグ修正
工事台帳一覧:給料集計SQLを一括で処理するように変更

差分を表示:

branches/src/ProcessManagement/ProcessManagement/Common/CommonMotions.cs
2920 2920
        }
2921 2921
        #endregion
2922 2922

  
2923
        #region 経過給与を一括計算する
2924
        /// <summary>
2925
        /// 経過給与を一括計算する
2926
        /// </summary>
2927
        /// <param name="dtStart"></param>
2928
        /// <param name="PersonCode"></param>
2929
        /// <returns></returns>
2930
        public static void CalcElapsedSalaryAll(IOMPersonInCharge SalDB, ArrayList TargetList, ref List<KeyValuePair<int, long>> SalDataList)
2931
        {
2932
            try
2933
            {
2934

  
2935
                StringBuilder strSQL = new StringBuilder();
2936

  
2937
                bool bFirst = true;
2938
                foreach (object[] ObjRec in TargetList)
2939
                {
2940
                    int PersonCode = CommonMotions.cnvInt(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.PersonCode]);
2941
                    DateTime dtStart = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.StartDate]);
2942
                    DateTime dtLast = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.CompDate]);
2943

  
2944
                    if (!bFirst) strSQL.Append(" UNION ");
2945

  
2946
                    strSQL.AppendFormat("SELECT {0} As LinkKey, SUM(SAL{0}.SALARY) FROM", PersonCode);
2947

  
2948
                    strSQL.Append(" (SELECT AX.hiduke,");
2949
                    //strSQL.AppendFormat(" ROUND((AX.salary * {0}) / DATE_FORMAT(LAST_DAY(AX.hiduke), '%d')) AS SALARY,", CommonDefine.s_SalaryCorrection);
2950
                    strSQL.AppendFormat(" ROUND((AX.salary * {0}) / 30) AS SALARY,", CommonDefine.s_SalaryCorrection);
2951
                    strSQL.Append(" MAX(AX.StartD) FROM");
2952
                    strSQL.Append(" (SELECT A.d hiduke, B.MonthlySalary salary, B.STARTDATE StartD FROM");
2953

  
2954
                    strSQL.Append(" (SELECT A1.years, A2.month, A3.days, DATE(CONCAT(A1.years, '/', A2.month, '/', A3.days)) AS d");
2955
                    strSQL.Append(" FROM yearmaster AS A1, monthmaster AS A2, daymaster AS A3");
2956

  
2957
                    strSQL.Append(" WHERE");
2958
                    if (dtStart.Year == dtLast.Year)
2959
                    {
2960
                        strSQL.AppendFormat(" (A1.years = {0} AND A2.month IN(", dtStart.Year.ToString("0000"));
2961
                        for (int i = dtStart.Month; i <= dtLast.Month; i++)
2962
                        {
2963
                            if (i != dtStart.Month) strSQL.Append(", ");
2964
                            strSQL.AppendFormat("{0} ", i);
2965
                        }
2966
                        strSQL.Append("))");
2967
                    }
2968
                    else
2969
                    {
2970
                        strSQL.Append(" (");
2971

  
2972
                        for (int iYear = dtStart.Year; iYear <= dtLast.Year; iYear++)
2973
                        {
2974
                            // 先頭以外はORを追加する
2975
                            if (iYear != dtStart.Year) strSQL.AppendFormat(" OR");
2976

  
2977
                            strSQL.AppendFormat(" (A1.years = {0}", iYear.ToString("0000"));
2978
                            strSQL.Append(" AND A2.month IN (");
2979

  
2980
                            if (iYear == dtStart.Year)
2981
                            {   // 先頭年
2982
                                for (int i = dtStart.Month; i <= 12; i++)
2983
                                {
2984
                                    if (i != dtStart.Month) strSQL.Append(", ");
2985
                                    strSQL.AppendFormat("{0} ", i);
2986
                                }
2987
                            }
2988
                            else if (iYear == dtLast.Year)
2989
                            {   // 最終年
2990
                                for (int i = 1; i <= dtLast.Month; i++)
2991
                                {
2992
                                    if (i != 1) strSQL.Append(", ");
2993
                                    strSQL.AppendFormat("{0} ", i);
2994
                                }
2995
                            }
2996
                            else
2997
                            {   // 以外の年
2998
                                for (int i = 1; i <= 12; i++)
2999
                                {
3000
                                    if (i != 1) strSQL.Append(", ");
3001
                                    strSQL.AppendFormat("{0} ", i);
3002
                                }
3003
                            }
3004
                            strSQL.Append("))");
3005
                        }
3006
                        strSQL.Append(")");
3007
                    }
3008

  
3009
                    strSQL.Append(" AND DATE(CONCAT(A1.years, '/', A2.month, '/', A3.days)) IS NOT NULL");
3010
                    strSQL.AppendFormat(" AND (DATE('{0}') <= DATE(CONCAT(A1.years, '/', A2.month, '/', A3.days))", dtStart.ToShortDateString());
3011
                    strSQL.AppendFormat(" AND DATE(CONCAT(A1.years, '/', A2.month, '/', A3.days)) <= DATE('{0}'))", dtLast.ToShortDateString());
3012
                    strSQL.Append(" ORDER BY d) A");
3013
                    strSQL.Append(", PERSONSALARYMASTER AS B");
3014
                    strSQL.AppendFormat(" WHERE B.PERSONCODE = {0}", PersonCode);
3015
                    strSQL.Append("       AND B.STARTDATE <= A.d");
3016
                    strSQL.Append(" ORDER BY A.d, B.STARTDATE DESC) AS AX");
3017
                    strSQL.Append(" GROUP BY AX.hiduke");
3018
                    strSQL.Append(" ORDER BY AX.hiduke");
3019
                    strSQL.AppendFormat(" ) AS SAL{0}", PersonCode);
3020

  
3021
                    bFirst = false;
3022
                }
3023

  
3024
                ArrayList ArData = new ArrayList();
3025
                if (!SalDB.ExecuteReader(strSQL.ToString(), ref ArData)) return;
3026

  
3027
                foreach (object[] objRec in ArData)
3028
                {
3029
                    SalDataList.Add(new KeyValuePair<int, long>(CommonMotions.cnvInt(objRec[0]), CommonMotions.cnvLong(objRec[1])));
3030
                }
3031

  
3032
            }
3033
            catch (Exception ex)
3034
            {
3035
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
3036
            }
3037
        }
3038
        #endregion
3039

  
3040
        #region 期間より零れた経過給与を取得しデータテーブルの開始終了日を変更する
3041
        /// <summary>
3042
        /// 期間より零れた経過給与を取得しデータテーブルの開始終了日を変更する
3043
        /// </summary>
3044
        /// <returns></returns>
3045
        public static void CalcSpilledSalaryAll(IOMPersonInCharge SalDB
3046
                                            , int TargetYear
3047
                                            , ref ArrayList TargetList)
3048
        {
3049
            try
3050
            {
3051
                // デフォルト開始・終了を取得する
3052
                DateTime dtDefaultStart = CommonMotions.GetOpeningEndDate(TargetYear, true);
3053
                DateTime dtDefaultEnd = CommonMotions.GetOpeningEndDate(TargetYear, false);
3054
                DateTime dtPrevEnd = CommonMotions.GetOpeningEndDate((TargetYear - 1), false);
3055

  
3056
                // 先期の期末を取得する
3057
                int PrevTargetYear = (TargetYear - 1);
3058
                if (PrevTargetYear < 1) return;
3059

  
3060
                List<KeyValuePair<DateTime, DateTime>> wrkStEdDate = new List<KeyValuePair<DateTime, DateTime>>();
3061
                bool bFirst = true;
3062
                StringBuilder strSQL = new StringBuilder();
3063
                foreach (object[] ObjRec in TargetList)
3064
                {
3065
                    // 開始・終了日が無い場合はデフォルトの期首・期末を使用する
3066
                    DateTime stDate = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.StartDate]);
3067
                    DateTime edDate = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.CompDate]);
3068
                    CalcStartCompDate(TargetYear,
3069
                                        dtDefaultStart, dtDefaultEnd,
3070
                                        CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.HireStartDays]),
3071
                                        CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.HireCompDays]),
3072
                                        CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.NextStartDate]),
3073
                                        CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.NextCompDate]),
3074
                                        ref stDate, ref edDate);
3075

  
3076
                    int nPersonCode = CommonMotions.cnvInt(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.PersonCode]);
3077
                    wrkStEdDate.Add(new KeyValuePair<DateTime, DateTime>(stDate, edDate));
3078

  
3079
                    // 今期の最初が先期の最後より大きい場合は処理しない
3080
                    //if (dtPrevEnd < stDate) continue;
3081

  
3082
                    if (!bFirst) strSQL.Append(" Union ");
3083

  
3084
                    strSQL.Append("Select");
3085
                    strSQL.Append(" Base.ConstructionPeriod");
3086
                    strSQL.Append(", Base.ConstructionCode");
3087
                    strSQL.Append(", Base.ConstructionPersonCode");
3088
                    strSQL.Append(", Ledger.ConstructionStart");
3089
                    strSQL.Append(", Ledger.ConstructionEnd");
3090
                    strSQL.Append(", LDetail.GroupCount");
3091
                    strSQL.Append(", LDetail.SalaryFlg");
3092
                    strSQL.Append(", LDetail.SalaryDays");
3093
                    strSQL.Append(" From");
3094
                    strSQL.Append(" constructionbaseinfo As Base");
3095
                    strSQL.Append(" Inner Join constructionledger As Ledger");
3096
                    strSQL.Append("       On Ledger.ConstructionCode = Base.ConstructionCode");
3097
                    strSQL.AppendFormat("  And DATE('{0}') <= DATE(Ledger.ConstructionEnd)", dtDefaultStart.ToShortDateString());
3098
                    strSQL.Append(" Inner Join constructionledgerdetail As LDetail");
3099
                    strSQL.Append("       On LDetail.ConstructionCode = Base.ConstructionCode");
3100
                    strSQL.AppendFormat(" And LDetail.GroupCount = {0}", (int)FrmConstructionLedger.DataGroup.Payroll);
3101
                    strSQL.AppendFormat(" And LDetail.CompanyCode = {0}", nPersonCode);
3102
                    strSQL.AppendFormat(" And LDetail.SalaryFlg = {0}", (int)CommonDefine.SalaryDevision.DaysInput);
3103
                    strSQL.Append(" Where");
3104
                    strSQL.AppendFormat(" Base.ConstructionPeriod = {0}", TargetYear);
3105
                    strSQL.AppendFormat(" And Base.ConstructionPersonCode = {0}", nPersonCode);
3106
                    strSQL.Append(" And(");
3107
                    strSQL.AppendFormat("DATE('{0}') <= DATE(Ledger.ConstructionStart)", edDate.ToShortDateString());
3108
                    strSQL.AppendFormat(" And DATE(Ledger.ConstructionEnd) <= DATE('{0}')", dtDefaultEnd.ToShortDateString());
3109
                    strSQL.Append(")");
3110
                    strSQL.Append(" Union Select");
3111
                    strSQL.Append(" Base.ConstructionPeriod");
3112
                    strSQL.Append(", Base.ConstructionCode");
3113
                    strSQL.Append(", Base.ConstructionPersonCode");
3114
                    strSQL.Append(", Ledger.ConstructionStart");
3115
                    strSQL.Append(", Ledger.ConstructionEnd");
3116
                    strSQL.Append(", LDetail.GroupCount");
3117
                    strSQL.Append(", LDetail.SalaryFlg");
3118
                    strSQL.Append(", LDetail.SalaryDays");
3119
                    strSQL.Append(" From");
3120
                    strSQL.Append(" constructionbaseinfo As Base");
3121
                    strSQL.Append(" Inner Join constructionledger As Ledger");
3122
                    strSQL.Append("       On Ledger.ConstructionCode = Base.ConstructionCode");
3123
                    strSQL.Append(" Inner Join constructionledgerdetail As LDetail");
3124
                    strSQL.Append("       On LDetail.ConstructionCode = Base.ConstructionCode");
3125
                    strSQL.AppendFormat(" And LDetail.GroupCount = {0}", (int)FrmConstructionLedger.DataGroup.Payroll);
3126
                    strSQL.AppendFormat(" And LDetail.CompanyCode = {0}", nPersonCode);
3127
                    strSQL.AppendFormat(" And LDetail.SalaryFlg = {0}", (int)CommonDefine.SalaryDevision.DaysInput);
3128
                    strSQL.Append(" Where");
3129
                    strSQL.AppendFormat(" Base.ConstructionPeriod = {0}", PrevTargetYear);
3130
                    strSQL.AppendFormat(" And Base.ConstructionPersonCode = {0}", nPersonCode);
3131
                    strSQL.Append(" And(");
3132
                    strSQL.AppendFormat("DATE('{0}') <= DATE(Ledger.ConstructionStart)", (stDate.AddDays(-1)).ToShortDateString());
3133
                    strSQL.AppendFormat(" And DATE(Ledger.ConstructionEnd) <= DATE('{0}')", dtPrevEnd.ToShortDateString());
3134
                    strSQL.Append(")");
3135

  
3136
                    bFirst = false;
3137
                }
3138
                // データ取得
3139
                ArrayList ArData = new ArrayList();
3140
                if (!SalDB.ExecuteReader(strSQL.ToString(), ref ArData)) return;
3141

  
3142
                int DateCnt = 0;
3143
                foreach (object[] ObjRec in TargetList)
3144
                {
3145
                    int nPersonCode = CommonMotions.cnvInt(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.PersonCode]);
3146

  
3147
                    // 半端分の日数を取得する
3148
                    int NextDiffDay = ArData.Cast<object[]>().Where(x => CommonMotions.cnvInt(x[0]) == TargetYear
3149
                                                                    && CommonMotions.cnvInt(x[2]) == nPersonCode)
3150
                                                            .Sum(y => CommonMotions.cnvInt(y[7]));
3151

  
3152
                    // 先期の半端分の日数を取得する
3153
                    int PrevDiffDay = ArData.Cast<object[]>().Where(x => CommonMotions.cnvInt(x[0]) == PrevTargetYear
3154
                                                                    && CommonMotions.cnvInt(x[2]) == nPersonCode)
3155
                                                            .Sum(y => CommonMotions.cnvInt(y[7]));
3156

  
3157
                    KeyValuePair<DateTime, DateTime> CurStEd = wrkStEdDate[DateCnt++];
3158
                    // 今期終了日変更
3159
                    DateTime wrkDate = CurStEd.Value.AddDays(NextDiffDay);
3160
                    if (dtDefaultEnd.Date < wrkDate.Date) wrkDate = dtDefaultEnd;
3161
                    ObjRec[(int)CreateLedgerSQL.GetPersonTerm.CompDate] = wrkDate;
3162
                    // 今期開始日変更
3163
                    wrkDate = CurStEd.Key.AddDays(PrevDiffDay);
3164
                    if (dtDefaultEnd.Date < wrkDate.Date) wrkDate = dtDefaultEnd;
3165
                    ObjRec[(int)CreateLedgerSQL.GetPersonTerm.StartDate] = wrkDate;
3166
                }
3167

  
3168
            }
3169
            catch (Exception ex)
3170
            {
3171
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
3172
            }
3173
        }
3174
        #endregion
3175

  
3176
        #region 計算開始・終了日のチェック入れ替え
3177
        /// <summary>
3178
        /// 計算開始・終了日のチェック入れ替え
3179
        /// </summary>
3180
        public static void CalcStartCompDate(int BusinessPeriod,
3181
                                        DateTime dtDefaultStart, DateTime dtDefaultEnd,
3182
                                        DateTime HireStartDate, DateTime HireCompDate,
3183
                                        DateTime NextStartDate, DateTime NextCompDate,
3184
                                        ref DateTime StartDate, ref DateTime CompDate)
3185
        {
3186
            try
3187
            {
3188
                // ----- 計算開始日セット
3189
                if (StartDate == DateTime.MinValue)
3190
                {
3191
                    StartDate = dtDefaultStart;
3192
                }
3193
                else if (dtDefaultStart <= HireStartDate && HireStartDate <= dtDefaultEnd)
3194
                {
3195
                    StartDate = HireStartDate;
3196
                }
3197
                else if (dtDefaultStart < StartDate)
3198
                {
3199
                    StartDate = dtDefaultStart;
3200
                }
3201
                // 入社日が期内ならば開始を入社日にする
3202
                if (dtDefaultStart < HireStartDate && HireStartDate < dtDefaultEnd) StartDate = HireStartDate;
3203

  
3204
                // ----- 計算終了日セット
3205
                // Defaultは期末
3206
                CompDate = dtDefaultEnd;
3207

  
3208
                // 退社日が期内ならば終了を退社日にする
3209
                if (dtDefaultStart < HireCompDate && HireCompDate < dtDefaultEnd) CompDate = HireCompDate;
3210

  
3211
                // 来季の開始があって期末日より小さい場合は置き換える
3212
                if (NextStartDate != DateTime.MinValue)
3213
                {
3214
                    if (StartDate < NextStartDate && NextStartDate < CompDate) CompDate = NextStartDate.AddDays(-1);
3215
                }
3216
            }
3217
            catch (Exception ex)
3218
            {
3219
                logger.ErrorFormat("システムエラー:{0}", ex.Message);
3220
            }
3221
        }
3222
        #endregion
3223

  
2923 3224
        #region グリッド行退避エリア初期化処理
2924 3225
        /// <summary>
2925 3226
        /// グリッド行退避エリア初期化処理
branches/src/ProcessManagement/ProcessManagement/Common/CommonVersion.cs
14 14
        /// <summary>
15 15
        /// 本体バージョン
16 16
        /// </summary>
17
        public static int s_SystemVersion = 180;
17
        public static int s_SystemVersion = 181;
18 18

  
19 19
        /// <summary>
20 20
        /// コピー・環境バージョン
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ApprovalScreen/FrmApprovalScreen.cs
437 437
        {
438 438
            try
439 439
            {
440
                // ???F?????`?F?b?N
440
                // ???F???`?F?b?N
441
                if (!CheckUserAppStat()) return;
442

  
443
                    // ???F?????`?F?b?N
441 444
                if (!ChkApprovalOrder()) return;
442 445

  
443 446
                // ??????`?F?b?N
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ApprovalScreen/FrmApprovalScreenAuxiliary.cs
1243 1243
        }
1244 1244
        #endregion
1245 1245

  
1246
        #region ログイン者・承認者の承認状態をグリッドから取る
1247
        /// <summary>
1248
        /// ログイン者・承認者の承認状態をグリッドから取る
1249
        /// </summary>
1250
        /// <returns></returns>
1251
        private bool CheckUserAppStat()
1252
        {
1253
            try
1254
            {
1255
                DataGridView dgv = dgvEntryData;
1256

  
1257
                int nPresonCode = (int)DispGridColumn.ApprovalCode;
1258
                DataGridViewRow[] CurRow = dgv.Rows.Cast<DataGridViewRow>()
1259
                                                    .Where(x => CommonMotions.cnvInt(x.Cells[nPresonCode].Value) == CommonMotions.LoginUserData.PersonCode)
1260
                                                    .ToArray();
1261
                // ----- グリッドに無いものは処理できない
1262
                if (CurRow.Count() < 1) return false;
1263

  
1264
                // ----- 承認済みは処理できない
1265
                // グリッドの承認文字を取得する
1266
                int nGridAppStat = (int)DispGridColumn.ApprovalStatus;
1267
                string strGridApp = CommonMotions.cnvString(CurRow[0].Cells[nGridAppStat].Value);
1268
                // 承認文字を取得する
1269
                int nAppStat = (int)CommonDefine.ApprovalStatus.Approval;
1270
                string strAppString = CommonDefine.ApprovalStatusString[nAppStat];
1271
                if (strGridApp == strAppString)
1272
                {
1273
                    MessageBox.Show("既に承認されています。", "承認エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
1274
                    return false;
1275
                }
1276

  
1277
                return true;
1278
            }
1279
            catch (Exception ex)
1280
            {
1281
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
1282
                return false;
1283
            }
1284
        }
1285
        #endregion
1286

  
1246 1287
        #region ---------->> 指示連絡コメント処理
1247 1288
        #region 指示連絡コメント表示処理
1248 1289
        /// <summary>
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedgerList/CreateLedgerSQL.cs
229 229
                DateTime dtDefaultEnd = CommonMotions.GetOpeningEndDate(TargetNum, false);
230 230
                DateTime stDate = DateTime.Today;
231 231
                DateTime edDate = DateTime.Today;
232
                DateTime DspSTDate = DateTime.MaxValue;
233
                DateTime DspEdDate = DateTime.MinValue;
234 232

  
235

  
236 233
                // 給与を集計する
237 234
                foreach (object[] ObjRec in TargetList)
238 235
                {
......
479 476
            }
480 477
        }
481 478
        #endregion
482

  
479
        
483 480
        #region 担当者毎割当無費目毎の経費を取得する(一括バージョン)
484 481
        /// <summary>
485 482
        /// 担当者毎割当無費目毎の経費を取得する(一括バージョン)
......
556 553
            }
557 554
        }
558 555
        #endregion
556

  
557
        #region 経過給与を一括取得する
558
        /// <summary>
559
        /// 経過給与を一括取得する
560
        /// </summary>
561
        public static void GetElapsedSalaryAll(IOMPersonInCharge SalaryDB, int TargetNum, ref ArrayList TargetList, ref List<SalaryClass> ArrarySalary)
562
        {
563
            try
564
            {
565
                // 零れた給与日数取得とデータテーブル加工
566
                CommonMotions.CalcSpilledSalaryAll(SalaryDB, TargetNum, ref TargetList);
567

  
568
                // 給与累積取得
569
                List<KeyValuePair<int, long>> SalDataList = new List<KeyValuePair<int, long>>();
570
                CommonMotions.CalcElapsedSalaryAll(SalaryDB, TargetList, ref SalDataList);
571

  
572
                foreach (object[] ObjRec in TargetList)
573
                {
574
                    int nDepartmentCode = CommonMotions.cnvInt(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.DepartmentCode]);
575
                    int nPersonCode = CommonMotions.cnvInt(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.PersonCode]);
576
                    DateTime stDate = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.StartDate]);
577
                    DateTime edDate = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.CompDate]);
578

  
579
                    KeyValuePair<int, long> CurValuePair = SalDataList.Find(x => x.Key == nPersonCode);
580

  
581
                    // 配列セット
582
                    ArrarySalary.Add(new SalaryClass(nDepartmentCode, nPersonCode, (int)CurValuePair.Value, stDate, edDate));
583
                }
584
            }
585
            catch (Exception ex)
586
            {
587
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
588
            }
589
        }
590
        #endregion
591

  
592
        #region 担当者毎割当無費目毎の経費を一括取得する
593
        /// <summary>
594
        /// 担当者毎割当無費目毎の経費を一括取得する
595
        /// </summary>
596
        public static void GetPersonExpensesCostValueAll(IOCostDataOfPerson CostDB,
597
                                                        int nNowYear,
598
                                                        List<SalaryClass> ArrarySalary,
599
                                                        ref List<PersonExpensesCost> CostValue)
600
        {
601
            try
602
            {
603
                // デフォルト開始・終了を取得する
604
                DateTime dtDefaultStart = CommonMotions.GetOpeningEndDate(nNowYear, true);
605
                DateTime dtDefaultEnd = CommonMotions.GetOpeningEndDate(nNowYear, false);
606

  
607
                // 担当者毎経費データよりどこの工事にも所属していない経費を取得する
608
                bool bFirst = true;
609
                StringBuilder strSQL = new StringBuilder();
610
                foreach (SalaryClass CurData in ArrarySalary)
611
                {
612
                    if(!bFirst) strSQL.Append(" UNION ");
613
                    strSQL.Append("SELECT");
614
                    strSQL.Append(" PERSONCODE");
615
                    strSQL.Append(", B.DATATYPE AS DATATYPE");
616
                    strSQL.Append(", SUM(B.ENTRYPRICE) AS SUMPRICE");
617
                    strSQL.Append(" FROM");
618
                    strSQL.Append(" COSTDATAOFPERSON AS B");
619
                    strSQL.Append(" WHERE");
620

  
621
                    strSQL.AppendFormat(" B.PERSONCODE = {0}", CurData.PersonCode);
622

  
623
                    strSQL.AppendFormat(" AND (DATE('{0}') <= DATE(B.ACTIONDATE)", dtDefaultStart.ToShortDateString());
624
                    strSQL.AppendFormat(" AND DATE(B.ACTIONDATE) <= DATE('{0}'))", dtDefaultEnd.ToShortDateString());
625
                    strSQL.Append(" AND B.CONSTRUCTIONCODE = 0");
626
                    strSQL.Append(" GROUP BY B.DATATYPE");
627

  
628
                    bFirst = false;
629
                }
630
                // データ取得
631
                ArrayList arList = new ArrayList();
632
                if (!CostDB.ExecuteReader(strSQL.ToString(), ref arList)) return;
633

  
634
                // データセット
635
                int[] GetCostVal = new int[CostDataOfPerson.DataNoStrArrary.Length];
636
                foreach (SalaryClass CurData in ArrarySalary)
637
                {
638
                    Array.Clear(GetCostVal, 0, GetCostVal.Length);
639
                    // 取得結果を振り分ける
640
                    foreach (object[] wrkobj in arList)
641
                    {
642
                        for (int i = (int)CostDataOfPerson.DataNoDef.Transport
643
                                    ; i <= (int)CostDataOfPerson.DataNoDef.DisposalCost
644
                                    ; i++)
645
                        {
646
                            GetCostVal[i] = arList.Cast<object[]>().Where(x => CommonMotions.cnvInt(x[0]) == CurData.PersonCode
647
                                                                            && CommonMotions.cnvInt(x[1]) == i)
648
                                                                    .Sum(y => CommonMotions.cnvInt(y[2]));
649
                        }
650
                    }
651

  
652
                    CostValue.Add(new PersonExpensesCost(CurData.DepartmentCode
653
                                                            , CurData.PersonCode
654
                                                            , CurData.StartDate
655
                                                            , CurData.CompDate
656
                                                            , new int[] { GetCostVal[0], GetCostVal[1], GetCostVal[2],
657
                                                                                GetCostVal[3],GetCostVal[4],GetCostVal[5],
658
                                                                                GetCostVal[6] }));
659
                }
660
            }
661
            catch (Exception ex)
662
            {
663
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
664
            }
665
        }
666
        #endregion
559 667
    }
560 668
}
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedgerList/FrmConstructionLedgerListAuxiliary.cs
1009 1009

  
1010 1010
                // ????o????^????????
1011 1011
                List<SalaryClass> ArrarySalary = new List<SalaryClass>();
1012
                CreateLedgerSQL.GetElapsedSalary(SalaryDB, (int)numUDConstPro.Value, TargetList, ref ArrarySalary);
1012
                //CreateLedgerSQL.GetElapsedSalary(SalaryDB, (int)numUDConstPro.Value, TargetList, ref ArrarySalary);
1013
                CreateLedgerSQL.GetElapsedSalaryAll(SalaryDB, (int)numUDConstPro.Value, ref TargetList, ref ArrarySalary);
1013 1014

  
1014 1015
                // ????o?????????
1015 1016
                List<PersonExpensesCost> ArraryCost = new List<PersonExpensesCost>();
1016
                CreateLedgerSQL.GetPersonExpensesCostValue(CostDB, (int)numUDConstPro.Value, ArrarySalary, ref ArraryCost);
1017
                //CreateLedgerSQL.GetPersonExpensesCostValue(CostDB, (int)numUDConstPro.Value, ArrarySalary, ref ArraryCost);
1018
                CreateLedgerSQL.GetPersonExpensesCostValueAll(CostDB, (int)numUDConstPro.Value, ArrarySalary, ref ArraryCost);
1017 1019

  
1018 1020
                // ProgressBar??l???X????
1019 1021
                prgber.Value++;
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/DepExpenssList/FrmDepExpenssListAuxiliary.cs
813 813

  
814 814
                // ????o????^????????
815 815
                List<SalaryClass> ArrarySalary = new List<SalaryClass>();
816
                CreateLedgerSQL.GetElapsedSalary(SalaryDB, (int)numUDConstPro.Value, TargetList, ref ArrarySalary);
816
                //CreateLedgerSQL.GetElapsedSalary(SalaryDB, (int)numUDConstPro.Value, TargetList, ref ArrarySalary);
817
                CreateLedgerSQL.GetElapsedSalaryAll(SalaryDB, (int)numUDConstPro.Value, ref TargetList, ref ArrarySalary);
817 818

  
818 819
                // ProgressBar??l???X????
819 820
                prgber.Value++;
......
821 822

  
822 823
                // ????o?????????
823 824
                List<PersonExpensesCost> ArraryCost = new List<PersonExpensesCost>();
824
                CreateLedgerSQL.GetPersonExpensesCostValue(CostDB, (int)numUDConstPro.Value, ArrarySalary, ref ArraryCost);
825
                //CreateLedgerSQL.GetPersonExpensesCostValue(CostDB, (int)numUDConstPro.Value, ArrarySalary, ref ArraryCost);
826
                CreateLedgerSQL.GetPersonExpensesCostValueAll(CostDB, (int)numUDConstPro.Value, ArrarySalary, ref ArraryCost);
825 827

  
826 828
                // ProgressBar??l???X????
827 829
                prgber.Value++;
828 830
                prgber.Update();
829 831

  
830
                // ?f?t?H???g?J?n?E?I??????????
831
                DateTime dtDefaultStart = CommonMotions.GetOpeningEndDate((int)numUDConstPro.Value, true);
832
                DateTime dtDefaultEnd = CommonMotions.GetOpeningEndDate((int)numUDConstPro.Value, false);
833

  
834 832
                // ----- ?o????^?\???i?w?b?_?[??\???j
835
                SetPayrollData(TargetList, dtDefaultStart, dtDefaultEnd, SalaryDB, LedgerDB, ArrarySalary);
833
                SetPayrollData(TargetList, LedgerDB, ArrarySalary);
836 834

  
837 835
                // ProgressBar??l???X????
838 836
                prgber.Value++;
......
873 871
                int[] TotalArea = new int[TotalColCnt];
874 872
                Array.Clear(TotalArea, 0, TotalArea.Length);
875 873

  
874
                // ?f?t?H???g?J?n?E?I??????????
875
                DateTime dtDefaultStart = CommonMotions.GetOpeningEndDate((int)numUDConstPro.Value, true);
876
                DateTime dtDefaultEnd = CommonMotions.GetOpeningEndDate((int)numUDConstPro.Value, false);
877

  
876 878
                int ino = 1;
877 879
                // ?f?[?^?\??
878 880
                if (arData.Count != 0)
......
1249 1251
        /// <summary>
1250 1252
        /// ??????o????^??\??????
1251 1253
        /// </summary>
1252
        private void SetPayrollData(ArrayList TargetList,
1253
                                    DateTime dtDefaultStart, DateTime dtDefaultEnd,
1254
                                    IOMPersonInCharge SalaryDB, IOConstructionLedger LedgerDB,
1254
        private void SetPayrollData(ArrayList TargetList, IOConstructionLedger LedgerDB,
1255 1255
                                    List<SalaryClass> ArrarySalary)
1256 1256
        {
1257 1257
            try
1258 1258
            {
1259

  
1260 1259
                //Debug.WriteLine("---------------------");
1261 1260
                // ?????R?[?h??
1262 1261
                int DepartmentCode = GetDepartmentCode();
branches/src/ProcessManagement/ProcessManagement/Properties/AssemblyInfo.cs
32 32
// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を 
33 33
// 既定値にすることができます:
34 34
// [assembly: AssemblyVersion("1.0.*")]
35
[assembly: AssemblyVersion("1.0.1.180")]
36
[assembly: AssemblyFileVersion("1.0.1.180")]
35
[assembly: AssemblyVersion("1.0.1.181")]
36
[assembly: AssemblyFileVersion("1.0.1.181")]
37 37
// Log4netを使用する
38 38
[assembly: log4net.Config.XmlConfigurator(ConfigFile = @"log4net.config", Watch = true)]

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