プロジェクト

全般

プロフィール

リビジョン 483

堀内4年以上前に追加

オリジナルリビジョン:573相当

差分を表示:

trunk/src/ProcessManagement/ProcessManagement/Common/CommonDefine.cs
226 226
        /// </summary>
227 227
        public static string s_ExecCurrentDirName = @"C:\Users\Default\Desktop\";
228 228
        public static string s_SaveExecl = @"SaveExcel";
229
        public static string s_ExecExcelDirName = @"見積もりエクセルデータ";
230 229
        #endregion
231 230

  
232 231
        #region ワード使用時パス
......
1207 1206
        /// </summary>
1208 1207
        public static string[] Type2YearString = new string[] { "対象年", "年" };
1209 1208
        #endregion
1209

  
1210
        #region 有給取得日数テーブル
1211
        /// <summary>
1212
        /// 有給取得日数テーブル
1213
        /// 年度:1年目  :10日
1214
        ///    2年目  :11日
1215
        ///    3年目  :12日
1216
        ///    4年目  :14日
1217
        ///    5年目  :16日
1218
        ///    6年目  :18日
1219
        ///    7年目以降:20日
1220
        /// </summary>
1221
        public static List<decimal> PaidHolidayTable = new List<decimal> { 10, 11, 12, 14, 16, 18, 20 };
1222
        #endregion
1210 1223
    }
1211 1224
}
trunk/src/ProcessManagement/ProcessManagement/Common/CommonMotions.cs
2959 2959

  
2960 2960
        #region TimeSpanから年数を取得する
2961 2961
        /// <summary>
2962
        /// TimeSpanから年数を取得する
2962
        /// TimeSpanから年数を取得する(切り上げ)
2963 2963
        /// </summary>
2964 2964
        /// <param name="timespan"></param>
2965 2965
        /// <returns></returns>
2966 2966
        public static int GetTimeSpanYears(this TimeSpan timespan)
2967 2967
        {
2968
            return (int)((double)timespan.Days / 365.2425);
2968
            return CommonMotions.cnvRoundUp((double)timespan.Days / 365.2425);
2969 2969
        }
2970 2970
        #endregion
2971 2971

  
......
3411 3411
                strSQL.AppendFormat("  And DATE('{0}') <= DATE(Ledger.ConstructionEnd)", dtDefaultStart.ToShortDateString());
3412 3412
                strSQL.Append(" Inner Join constructionledgerdetail As LDetail");
3413 3413
                strSQL.Append("       On LDetail.ConstructionCode = Base.ConstructionCode");
3414
                strSQL.AppendFormat(" And LDetail.GroupCount = {0}", (int)FrmConstructionLedger.DataGroup.Payroll);
3414
                strSQL.AppendFormat(" And LDetail.GroupCount = {0}", (int)ConstructionLedgerDetail.GroupCountDef.Payroll);
3415 3415
                strSQL.AppendFormat(" And LDetail.CompanyCode = {0}", PersonCode);
3416 3416
                strSQL.AppendFormat(" And LDetail.SalaryFlg = {0}", (int)CommonDefine.SalaryDevision.DaysInput);
3417 3417
                strSQL.Append(" Where");
......
3478 3478
                strSQL.Append("       On Ledger.ConstructionCode = Base.ConstructionCode");
3479 3479
                strSQL.Append(" Inner Join constructionledgerdetail As LDetail");
3480 3480
                strSQL.Append("       On LDetail.ConstructionCode = Base.ConstructionCode");
3481
                strSQL.AppendFormat(" And LDetail.GroupCount = {0}", (int)FrmConstructionLedger.DataGroup.Payroll);
3481
                strSQL.AppendFormat(" And LDetail.GroupCount = {0}", (int)ConstructionLedgerDetail.GroupCountDef.Payroll);
3482 3482
                strSQL.AppendFormat(" And LDetail.CompanyCode = {0}", PersonCode);
3483 3483
                strSQL.AppendFormat(" And LDetail.SalaryFlg = {0}", (int)CommonDefine.SalaryDevision.DaysInput);
3484 3484
                strSQL.Append(" Where");
......
3719 3719
                    strSQL.AppendFormat("  And DATE('{0}') <= DATE(Ledger.ConstructionEnd)", dtDefaultStart.ToShortDateString());
3720 3720
                    strSQL.Append(" Inner Join constructionledgerdetail As LDetail");
3721 3721
                    strSQL.Append("       On LDetail.ConstructionCode = Base.ConstructionCode");
3722
                    strSQL.AppendFormat("  And LDetail.GroupCount = {0}", (int)FrmConstructionLedger.DataGroup.Payroll);
3722
                    strSQL.AppendFormat("  And LDetail.GroupCount = {0}", (int)ConstructionLedgerDetail.GroupCountDef.Payroll);
3723 3723
                    strSQL.AppendFormat("  And LDetail.ComponentCode = {0}", nDepCode);
3724 3724
                    strSQL.AppendFormat("  And LDetail.CompanyCode = {0}", nPersonCode);
3725 3725
                    strSQL.AppendFormat("  And LDetail.SalaryFlg = {0}", (int)CommonDefine.SalaryDevision.DaysInput);
......
3757 3757
                    strSQL.Append("       On Ledger.ConstructionCode = Base.ConstructionCode");
3758 3758
                    strSQL.Append(" Inner Join constructionledgerdetail As LDetail");
3759 3759
                    strSQL.Append("       On LDetail.ConstructionCode = Base.ConstructionCode");
3760
                    strSQL.AppendFormat("  And LDetail.GroupCount = {0}", (int)FrmConstructionLedger.DataGroup.Payroll);
3760
                    strSQL.AppendFormat("  And LDetail.GroupCount = {0}", (int)ConstructionLedgerDetail.GroupCountDef.Payroll);
3761 3761
                    strSQL.AppendFormat("  And LDetail.ComponentCode = {0}", nDepCode);
3762 3762
                    strSQL.AppendFormat("  And LDetail.CompanyCode = {0}", nPersonCode);
3763 3763
                    strSQL.AppendFormat("  And LDetail.SalaryFlg = {0}", (int)CommonDefine.SalaryDevision.DaysInput);
......
4025 4025
                    strSQL.Append(", A.DISPLAYORDER");
4026 4026
                    strSQL.Append(", 1");
4027 4027
                    strSQL.Append(" From DEPARTMENTMASTER As A");
4028
                    strSQL.AppendFormat(" Where DeleteFlg = {0}", (int)CommonDefine.DataDeleteDef.Exists);
4028 4029
                    return;
4029 4030
                }
4030 4031

  
......
4185 4186
                }
4186 4187
                else
4187 4188
                {
4188
                    strSQL.AppendFormat(" AND ((DATE(AB.STARTDATE) <= DATE('{0}'))", dtDefaultEnd.ToShortDateString());
4189
                    strSQL.AppendFormat(" AND(DATE('{0}') <= DATE(AB.CompDate)", dtDefaultStart.ToShortDateString());
4190
                    strSQL.AppendFormat(" OR DATE('{0}') = DATE(AB.CompDate)))", DateTime.MinValue.ToShortDateString());
4189
                    strSQL.AppendFormat(" AND DATE('{0}') <= DATE(AB.CompDate)", dtDefaultEnd.ToShortDateString());
4190

  
4191
                    //strSQL.AppendFormat(" AND ((DATE(AB.STARTDATE) <= DATE('{0}'))", dtDefaultEnd.ToShortDateString());
4192
                    //strSQL.AppendFormat(" AND(DATE('{0}') <= DATE(AB.CompDate)", dtDefaultStart.ToShortDateString());
4193
                    //strSQL.AppendFormat(" OR DATE('{0}') = DATE(AB.CompDate)))", DateTime.MinValue.ToShortDateString());
4191 4194
                }
4192 4195

  
4193 4196
                if (bNowSeason)
......
4443 4446
                    strSQL.Append(", A.NAMECODE");
4444 4447
                    strSQL.Append(", B.DEPARTMENTCODE");
4445 4448
                    strSQL.Append(", A.DeleteFlg");
4446
                    strSQL.Append(" FROM");
4447
                    strSQL.Append(" DIVISIONMASTER AS A");
4449
                    strSQL.Append(" FROM DIVISIONMASTER AS A");
4448 4450

  
4449
                    strSQL.Append(" LEFT JOIN (");
4450
                    strSQL.Append("SELECT");
4451
                    strSQL.Append(" BB.NAMECODE");
4452
                    strSQL.Append(", BB.DEPARTMENTCODE");
4453
                    strSQL.Append(", BB.EXPENSESRAITO");
4454
                    strSQL.Append(", BB.EXPENSESPERIOD");
4455
                    strSQL.Append(", BB.DisplayOrder");
4456
                    strSQL.Append(" FROM");
4457
                    strSQL.Append(" DEPARTMENTEXPENSESMASTER AS BB) AS B");
4458
                    strSQL.Append(" ON A.NAMECODE = B.NAMECODE");
4451
                    strSQL.Append(" LEFT JOIN (SELECT");
4452
                    strSQL.Append("                BB.NAMECODE");
4453
                    strSQL.Append("              , BB.DEPARTMENTCODE");
4454
                    strSQL.Append("              , BB.EXPENSESRAITO");
4455
                    strSQL.Append("              , BB.EXPENSESPERIOD");
4456
                    strSQL.Append("              , BB.DisplayOrder");
4457
                    strSQL.Append("            FROM DEPARTMENTEXPENSESMASTER AS BB) AS B");
4458
                    strSQL.Append("      ON A.NAMECODE = B.NAMECODE");
4459 4459
                    strSQL.AppendFormat(" AND B.EXPENSESPERIOD = {0}", Preiod);
4460 4460
                    if(DepartmentCode > 0) strSQL.AppendFormat(" AND B.DEPARTMENTCODE = {0}", DepartmentCode);
4461 4461

  
4462 4462
                    strSQL.Append(" LEFT JOIN departmentmaster AS C");
4463
                    strSQL.Append(" On C.DepartmentCode = B.DEPARTMENTCODE");
4463
                    strSQL.Append("      On C.DepartmentCode = B.DEPARTMENTCODE");
4464 4464

  
4465
                    strSQL.AppendFormat(" WHERE A.DIVISIONCODE = {0}", (int)DivisionMaster.DivisionMasterCodeDef.ConstructionExpenses);
4465
                    strSQL.Append(" WHERE");
4466
                    strSQL.AppendFormat(" A.DIVISIONCODE = {0}", (int)DivisionMaster.DivisionMasterCodeDef.ConstructionExpenses);
4466 4467
                    strSQL.AppendFormat(" AND A.DeleteFlg = {0}", (int)CommonDefine.DataDeleteDef.Exists);
4468
                    strSQL.Append(" And B.EXPENSESRAITO > 0.00");
4467 4469

  
4468 4470
                    strSQL.Append(" ORDER BY A.DISPLAYORDER, C.DISPLAYORDER");
4469 4471
                }
......
4475 4477
                    strSQL.Append(", B.NAMECODE");
4476 4478
                    strSQL.Append(", B.DEPARTMENTCODE");
4477 4479
                    strSQL.Append(", B.DeleteFlg");
4478
                    strSQL.Append(" FROM");
4479
                    strSQL.Append(" DEPARTMENTEXPENSESMASTER AS B");
4480
                    strSQL.Append(" FROM DEPARTMENTEXPENSESMASTER AS B");
4480 4481

  
4481 4482
                    strSQL.Append(" INNER JOIN departmentmaster AS C");
4482 4483
                    strSQL.Append("        On C.DepartmentCode = B.DEPARTMENTCODE");
......
4485 4486
                    strSQL.AppendFormat("  ON D.DIVISIONCODE = {0}", (int)DivisionMaster.DivisionMasterCodeDef.ConstructionExpenses);
4486 4487
                    strSQL.Append("        And D.NameCode = B.NameCode");
4487 4488

  
4488
                    strSQL.AppendFormat(" WHERE B.EXPENSESPERIOD = {0}", Preiod);
4489
                    strSQL.Append(" WHERE");
4490
                    strSQL.AppendFormat(" B.EXPENSESPERIOD = {0}", Preiod);
4489 4491
                    if (DepartmentCode > 0) strSQL.AppendFormat(" AND B.DEPARTMENTCODE = {0}", DepartmentCode);
4492
                    strSQL.Append(" And B.EXPENSESRAITO > 0.00");
4493

  
4490 4494
                    strSQL.Append(" ORDER BY D.DeleteFlg, C.DISPLAYORDER, B.DISPLAYORDER");
4491 4495
                }
4492 4496

  
......
4695 4699
            IOMHolidayCalender CalDB = new IOMHolidayCalender();
4696 4700
            try
4697 4701
            {
4702
                // 当月以前は翌月1日をセットして抜ける
4703
                if(WorktDate.Year < DateTime.Today.Year
4704
                    || WorktDate.Month < DateTime.Today.Month)
4705
                {
4706
                    DateTime dtTarget = new DateTime(WorktDate.Year, WorktDate.Month, 1).AddMonths(1);
4707
                    return dtTarget;
4708
                }
4709

  
4698 4710
                StringBuilder strSQL = new StringBuilder();
4699 4711

  
4700 4712
                strSQL.Append("SELECT t1.d, DATE_FORMAT(C.HOLIDAY, '%Y/%m/%d') HOLIDAY FROM");
......
4707 4719
                strSQL.AppendFormat(" AND A2.month = {0}", WorktDate.Month);
4708 4720
                strSQL.Append("       AND CAST(CONCAT(A1.years, '/', A2.month, '/', A3.days) as DATE) IS NOT NULL) as t1");
4709 4721
                strSQL.Append("      LEFT JOIN HOLIDAYCALENDERMASTER C ON C.HOLIDAY = t1.d");
4722
                strSQL.Append(" Where");
4723
                strSQL.AppendFormat(" DATE(t1.d) <= DATE('{0}')", DateTime.Today.ToShortDateString());
4710 4724
                strSQL.Append(" ORDER BY t1.d Desc");
4711 4725

  
4712 4726
                ArrayList arList = new ArrayList();
4713 4727
                CalDB.ExecuteReader(strSQL.ToString(), ref arList);
4714 4728

  
4729
                DateTime dtRet = DateTime.MinValue;
4715 4730
                int nPrevCount = 0;
4716
                DateTime dtRet = DateTime.MinValue;
4717 4731
                foreach(object[] objCalender in arList)
4718 4732
                {
4719 4733
                    // まず今日を探す
trunk/src/ProcessManagement/ProcessManagement/Common/Process/ClsChangeLedgerData.cs
54 54
        /// 工事詳細台帳再計算処理(総支払額・粗利・給与・純利益が対象)
55 55
        /// </summary>
56 56
        /// <param name="ConstrCode"></param>
57
        private static bool LedgerRecalculate(IOConstructionLedgerExcute LedgerExcuteDB, List<int> ConstrCodeList)
57
        public static bool LedgerRecalculate(IOConstructionLedgerExcute LedgerExcuteDB, List<int> ConstrCodeList)
58 58
        {
59 59
            try
60 60
            {
61 61
                StringBuilder strSQL = new StringBuilder();
62 62
                bool bRet = true;
63 63

  
64
                // 対象データ取得
65
                List<int> GroupCodeList1 = new List<int>();
66
                List<int> GroupCodeList2 = new List<int>();
67
                List<int> GroupCodeList3 = new List<int>();
68
                List<int> GroupCodeList4 = new List<int>();
69
                // 集計コード一覧作成
70
                SetGroupCodeList(ref GroupCodeList1, ref GroupCodeList2, ref GroupCodeList3, ref GroupCodeList4);
71

  
72 64
                foreach (int ConstrCode in ConstrCodeList)
73 65
                {
74 66
                    // 工事台帳実行データよりグループごとの合計金額を取得する
......
86 78
                    if (InData.Count == 0) continue;
87 79

  
88 80
                    // 対象データ取得
89
                    int Payment = CalcGetTotal(InData, GroupCodeList1);                             // ----- 支払額
81
                    decimal Payment = InData.Cast<object[]>()                                                                                   // ----- 支払額
82
                                            .Where(x => CommonMotions.cnvInt(x[0]) == (int)ConstructionLedgerDetail.GroupCountDef.Expenses              // 1:経費
83
                                                    || CommonMotions.cnvInt(x[0]) == (int)ConstructionLedgerDetail.GroupCountDef.ConstructionCosts      // 2:施工費
84
                                                    || CommonMotions.cnvInt(x[0]) == (int)ConstructionLedgerDetail.GroupCountDef.TransportationCosts    // 3:交通費(通行料・電車代)
85
                                                    || CommonMotions.cnvInt(x[0]) == (int)ConstructionLedgerDetail.GroupCountDef.PurchaseCosts          // 4:購入品
86
                                                    || CommonMotions.cnvInt(x[0]) == (int)ConstructionLedgerDetail.GroupCountDef.VehicleLeaseFee        // 5:車両リース代
87
                                                    || CommonMotions.cnvInt(x[0]) == (int)ConstructionLedgerDetail.GroupCountDef.ParkingCosts           // 6:駐車場・資材置き場
88
                                                    || CommonMotions.cnvInt(x[0]) == (int)ConstructionLedgerDetail.GroupCountDef.RoomChargeCosts        // 7:宿泊費
89
                                                    || CommonMotions.cnvInt(x[0]) == (int)ConstructionLedgerDetail.GroupCountDef.DisposeCosts)          // 8:処分費等
90
                                            .Sum(y=>CommonMotions.cnvDecimal(y[1]));
90 91

  
91
                    int PExpenses = CalcGetTotal(InData, GroupCodeList2);                           // ----- 人件費
92
                    decimal PExpenses = InData.Cast<object[]>()                                                                                 // ----- 人件費
93
                                            .Where(x => CommonMotions.cnvInt(x[0]) == (int)ConstructionLedgerDetail.GroupCountDef.Instructor            // 9:指導員給料行
94
                                                    || CommonMotions.cnvInt(x[0]) == (int)ConstructionLedgerDetail.GroupCountDef.Assistant)             // 10:副担当者給料行
95
                                            .Sum(y => CommonMotions.cnvDecimal(y[1]));
92 96

  
93
                    int Allowance = CalcGetTotal(InData, GroupCodeList3);                           // ----- 給与
97
                    decimal Allowance = InData.Cast<object[]>()                                                                                 // ----- 給与
98
                                            .Where(x => CommonMotions.cnvInt(x[0]) == (int)ConstructionLedgerDetail.GroupCountDef.Payroll)              // 11:担当者給料行
99
                                            .Sum(y => CommonMotions.cnvDecimal(y[1]));
94 100

  
95
                    int Billing = CalcGetTotal(InData, GroupCodeList4);                             // ----- 請求額
101
                    decimal Compensation = InData.Cast<object[]>()                                                                              // ----- 補填
102
                                            .Where(x => CommonMotions.cnvInt(x[0]) == (int)ConstructionLedgerDetail.GroupCountDef.Compensation)         // 12:補填金額(金額がマイナスで入っている)
103
                                            .Sum(y => CommonMotions.cnvDecimal(y[1]));
96 104

  
105
                    decimal Billing = InData.Cast<object[]>()                                                                                   // ----- 請求額
106
                                            .Where(x => CommonMotions.cnvInt(x[0]) == (int)ConstructionLedgerDetail.GroupCountDef.BillingAmount)        // 14:請求金額
107
                                            .Sum(y => CommonMotions.cnvDecimal(y[1]));
108

  
97 109
                    // ----- 工事詳細台帳更新
98 110
                    strSQL.Clear();
99 111
                    strSQL.Append("UPDATE CONSTRUCTIONLEDGER SET");
100 112
                    strSQL.AppendFormat(" TOTALPAYMENT = {0}", Payment);
101
                    strSQL.AppendFormat(", GROSSPROFIT = {0}", (Billing - Payment));
113
                    strSQL.AppendFormat(", GROSSPROFIT = {0}", (Billing - (Payment + Compensation)));
102 114
                    strSQL.AppendFormat(", Allowance = {0}", Allowance);
103
                    strSQL.AppendFormat(", NETPROFIT = {0}", (Billing - (Payment + Allowance + PExpenses)));
115
                    strSQL.AppendFormat(", NETPROFIT = {0}", (Billing - ((Payment + Compensation) + Allowance + PExpenses)));
104 116
                    strSQL.AppendFormat(" WHERE CONSTRUCTIONCODE = {0}", ConstrCode);
105 117
                    if (!LedgerExcuteDB.ExecuteNonQuery(strSQL.ToString(), false))
106 118
                    {
......
118 130
        }
119 131
        #endregion
120 132

  
121
        #region 集計用コードセット
133
        #region 担当者購入品データ番号より工事詳細台帳のグループ番号を取得する
122 134
        /// <summary>
123
        /// 集計用コードセット
135
        /// 担当者購入品データ番号より工事詳細台帳のグループ番号を取得する
124 136
        /// </summary>
125
        private static void SetGroupCodeList(ref List<int> GroupCodeList1, ref List<int> GroupCodeList2,
126
                                                ref List<int> GroupCodeList3, ref List<int> GroupCodeList4)
127
        {
128
            try
129
            {
130
                // 対象データ取得
131
                // ----- 支払額コードセット
132
                GroupCodeList1.Add((int)FrmConstructionLedger.DataGroup.Expenses);               // 1:経費
133
                GroupCodeList1.Add((int)FrmConstructionLedger.DataGroup.ConstructionCosts);      // 2:施工費
134
                GroupCodeList1.Add((int)FrmConstructionLedger.DataGroup.TransportationCosts);    // 3:交通費(通行料・電車代)
135
                GroupCodeList1.Add((int)FrmConstructionLedger.DataGroup.PurchaseCosts);          // 4:購入品
136
                GroupCodeList1.Add((int)FrmConstructionLedger.DataGroup.VehicleLeaseFee);        // 5:車両リース代
137
                GroupCodeList1.Add((int)FrmConstructionLedger.DataGroup.ParkingCosts);           // 6:駐車場・資材置き場
138
                GroupCodeList1.Add((int)FrmConstructionLedger.DataGroup.RoomChargeCosts);        // 7:宿泊費
139
                GroupCodeList1.Add((int)FrmConstructionLedger.DataGroup.DisposeCosts);           // 8:処分費等
140

  
141
                // ----- 人件費コードセット
142
                GroupCodeList2.Add((int)FrmConstructionLedger.DataGroup.Instructor);             // 9:指導員給料行
143
                GroupCodeList2.Add((int)FrmConstructionLedger.DataGroup.Assistant);              // 10:副担当者給料行
144

  
145
                // ----- 給与コードセット
146
                GroupCodeList3.Add((int)FrmConstructionLedger.DataGroup.Payroll);                // 11:担当者給料行
147

  
148
                // ----- 請求額コードセット
149
                GroupCodeList4.Add((int)FrmConstructionLedger.DataGroup.BillingAmount);          // 14:請求金額
150
            }
151
            catch (System.Exception ex)
152
            {
153
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
154
            }
155
        }
156
        #endregion
157

  
158
        #region 配列リストより指定された合計を取得する
159
        /// <summary>
160
        /// 配列リストより指定された合計を取得する
161
        /// </summary>
162
        private static int CalcGetTotal(ArrayList InData, List<int> GroupCodeList)
163
        {
164
            try
165
            {
166
                int iRetVal = 0;
167

  
168
                int GrpNo = -1;
169
                foreach (int GroupCode in GroupCodeList)
170
                {
171
                    foreach (object[] CurRec in InData)
172
                    {
173
                        GrpNo = CommonMotions.cnvInt(CurRec[0]);
174

  
175
                        if (GroupCode != GrpNo) continue;
176

  
177
                        iRetVal += CommonMotions.cnvInt(CurRec[1]);
178
                    }
179
                }
180

  
181
                return iRetVal;
182
            }
183
            catch (System.Exception ex)
184
            {
185
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
186
                return 0;
187
            }
188
        }
189
        #endregion
190

  
191
        #region 工事詳細台帳のグループ番号を取得する
192
        /// <summary>
193
        /// 工事詳細台帳のグループ番号を取得する
194
        /// </summary>
195 137
        /// <param name="TargetData"></param>
196 138
        /// <returns></returns>
197 139
        public static int GetConstructionLedgerGroupNo(int TargetData)
......
202 144
            {
203 145
                case (int)CostDataOfPerson.DataNoDef.Transport:
204 146
                    // 交通費(通行料・電車代)
205
                    GroupNo = (int)FrmConstructionLedger.DataGroup.TransportationCosts;
147
                    GroupNo = (int)ConstructionLedgerDetail.GroupCountDef.TransportationCosts;
206 148
                    break;
207 149
                case (int)CostDataOfPerson.DataNoDef.Purchase:
208 150
                    // 購入品
209
                    GroupNo = (int)FrmConstructionLedger.DataGroup.PurchaseCosts;
151
                    GroupNo = (int)ConstructionLedgerDetail.GroupCountDef.PurchaseCosts;
210 152
                    break;
211 153
                case (int)CostDataOfPerson.DataNoDef.Lease:
212 154
                    // 車両リース代
213
                    GroupNo = (int)FrmConstructionLedger.DataGroup.VehicleLeaseFee;
155
                    GroupNo = (int)ConstructionLedgerDetail.GroupCountDef.VehicleLeaseFee;
214 156
                    break;
215 157
                case (int)CostDataOfPerson.DataNoDef.StoragePlace:
216 158
                    // 駐車場・資材置き場
217
                    GroupNo = (int)FrmConstructionLedger.DataGroup.ParkingCosts;
159
                    GroupNo = (int)ConstructionLedgerDetail.GroupCountDef.ParkingCosts;
218 160
                    break;
219 161
                case (int)CostDataOfPerson.DataNoDef.Lodging:
220 162
                    // 宿泊費
221
                    GroupNo = (int)FrmConstructionLedger.DataGroup.RoomChargeCosts;
163
                    GroupNo = (int)ConstructionLedgerDetail.GroupCountDef.RoomChargeCosts;
222 164
                    break;
223 165
                case (int)CostDataOfPerson.DataNoDef.DisposalCost:
224 166
                    // 処分費
225
                    GroupNo = (int)FrmConstructionLedger.DataGroup.DisposeCosts;
167
                    GroupNo = (int)ConstructionLedgerDetail.GroupCountDef.DisposeCosts;
226 168
                    break;
227 169
            }
228 170
            return GroupNo;
229 171
        }
230 172
        #endregion
231 173

  
232
        #region 工事詳細台帳より支払金額グリッドの先頭カラム数を取得する
233
        /// <summary>
234
        /// 工事詳細台帳より支払金額グリッドの先頭カラム数を取得する
235
        /// </summary>
236
        public static int GetLedgerColumnCount()
237
        {
238
            try
239
            {
240
                return (Enum.GetNames(typeof(FrmConstructionLedger.GridColumn)).Length - 1);
241
            }
242
            catch (System.Exception ex)
243
            {
244
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
245
                return 0;
246
            }
247
        }
248
        #endregion
249

  
250 174
        #region 対象年月から工事詳細台帳のグリッドカラム位置を算出する
251 175
        /// <summary>
252 176
        /// 対象年月から工事詳細台帳のグリッドカラム位置を算出する
......
313 237
                    DetailSQL.AppendFormat(" AND OperatingFlg = {0}", (int)ConstructionLedgerDetail.SalOpeKindDef.Oparateing);      // 対応中フラグ
314 238
                    DetailSQL.AppendFormat(" AND SALARYFLG != {0}", (int)CommonDefine.SalaryDevision.Noting);                       // 給与振分区分
315 239
                    DetailSQL.AppendFormat(" AND GROUPCOUNT IN ({0},{1},{2})",
316
                                                                    (int)FrmConstructionLedger.DataGroup.Instructor,        // 指導員給料
317
                                                                    (int)FrmConstructionLedger.DataGroup.Assistant,         // 副担当者給料
318
                                                                    (int)FrmConstructionLedger.DataGroup.Payroll);          // 担当者給料行
240
                                                                    (int)ConstructionLedgerDetail.GroupCountDef.Instructor,        // 指導員給料
241
                                                                    (int)ConstructionLedgerDetail.GroupCountDef.Assistant,         // 副担当者給料
242
                                                                    (int)ConstructionLedgerDetail.GroupCountDef.Payroll);          // 担当者給料行
319 243

  
320 244
                    if (!LedgerDeDB.SelectAction(DetailSQL.ToString(), ref DetailList, false) || DetailList.Count == 0) continue;
321 245

  
......
428 352
                // 支払給与計算
429 353
                switch (CurRec.GroupCount)
430 354
                {
431
                    case (int)FrmConstructionLedger.DataGroup.Instructor:       // 指導員給料
355
                    case (int)ConstructionLedgerDetail.GroupCountDef.Instructor:       // 指導員給料
432 356
                        SumSaraly = CommonMotions.cnvRound((double)CommonDefine.InstructorMonthryCost / MonthDayCnt);
433 357
                        SumSaraly *= (ts.Days + 1);
434 358
                        break;
435
                    case (int)FrmConstructionLedger.DataGroup.Assistant:        // 副担当者給料
359
                    case (int)ConstructionLedgerDetail.GroupCountDef.Assistant:        // 副担当者給料
436 360
                        SumSaraly = CommonMotions.cnvRound((double)CommonDefine.AssistantMonthryCost / MonthDayCnt);
437 361
                        SumSaraly *= (ts.Days + 1);
438 362
                        break;
439
                    case (int)FrmConstructionLedger.DataGroup.Payroll:          // 担当者給料行
363
                    case (int)ConstructionLedgerDetail.GroupCountDef.Payroll:          // 担当者給料行
440 364
                        // 範囲給与取得
441 365
                        SumSaraly = CommonMotions.CalcElapsedSalary(PersonDB, StartDate, CompDate, CurRec.CompanyCode, false);
442 366
                        break;
......
491 415
        }
492 416
        #endregion
493 417

  
494
        #region 日付指定時の給与書込み
495
        /// <summary>
496
        /// 日付指定時の給与書込み
497
        /// </summary>
498
        private static bool CalcSalaryDevisionDaysInput(IOConstructionLedgerExcute LedgerExDB,
499
                                                        IOMPersonInCharge PersonDB,
500
                                                        ConstructionLedger LedgerRec,
501
                                                        ConstructionLedgerDetail CurRec)
502
        {
503
            IOProcessApproval AppDB = new IOProcessApproval();
504
            try
505
            {
506
                StringBuilder strSQL = new StringBuilder();
507

  
508

  
509

  
510
                // 月末日より月日数を取得する
511
                int MonthDayCnt = DateTimeUtil.EndOfMonth(LedgerRec.ConstructionStart).Day;
512
                int OneDaySalary = 0;
513
                int nSalaryDays = 0;
514
                // 支払給与計算
515
                switch (CurRec.GroupCount)
516
                {
517
                    case (int)FrmConstructionLedger.DataGroup.Instructor:       // 指導員給料
518
                        OneDaySalary = CommonMotions.cnvRound((double)CommonDefine.InstructorMonthryCost / MonthDayCnt);
519
                        break;
520
                    case (int)FrmConstructionLedger.DataGroup.Assistant:        // 副担当者給料
521
                        OneDaySalary = CommonMotions.cnvRound((double)CommonDefine.AssistantMonthryCost / MonthDayCnt);
522
                        OneDaySalary *= CurRec.SalaryDays;
523
                        break;
524
                    case (int)FrmConstructionLedger.DataGroup.Payroll:          // 担当者給料行
525
                        // 給与取得
526
                        OneDaySalary = CommonMotions.CalcElapsedSalary(PersonDB
527
                                                                        , LedgerRec.ConstructionStart
528
                                                                        , LedgerRec.ConstructionStart
529
                                                                        , CurRec.CompanyCode
530
                                                                        , false);
531
                        break;
532
                }
533

  
534

  
535
                OneDaySalary *= nSalaryDays;
536

  
537
                // 工事予算が承認された月の位置に書く
538
                strSQL.Clear();
539
                strSQL.Append(AppDB.CreatePrimarykeyString(CurRec.SourceCode,
540
                                                            3,                                      // 工事予算承認番号(ClsExecuteが無いため)
541
                                                            (int)CommonDefine.s_Default_OrderNo,
542
                                                            1));                                    // 先頭レコード
543
                strSQL.AppendFormat(" AND ApprovalStatus = {0}", (int)CommonDefine.ApprovalStatus.Approval);
544
                ProcessApproval AppRec = new ProcessApproval();
545
                if (!AppDB.SelectAction(strSQL.ToString(), ref AppRec)) return false;
546

  
547
                // 実行データのキー部年月日は開始月の1日
548
                DateTime ParaDate = new DateTime(LedgerRec.ConstructionStart.Year
549
                                                , LedgerRec.ConstructionStart.Month, 1);
550
                // 台帳カラム位置
551
                int Columncnt = Enum.GetNames(typeof(FrmConstructionLedger.GridColumn)).Length - 1;
552

  
553
                // 増減データは承認データを日付として使用する
554
                if ((CurRec.SourceCode % 10) > 1)
555
                {
556
                    DateTime dtStart = LedgerRec.ConstructionStart;
557
                    // 工事詳細台帳実行データよりカラム対象の年月を取得する
558
                    DateTime wrkDate = GetConstructionLedgerStartDate(LedgerExDB, CurRec.ConstructionCode, false);
559
                    if (wrkDate.Date != DateTime.MinValue.Date) dtStart = wrkDate;
560

  
561
                    // 承認日付より持ってくる
562
                    Columncnt = CalcTargetMonthToColumn(LedgerExDB, false, LedgerRec.ConstructionCode, AppRec.PetitionApprovalDate);
563
                    ParaDate = new DateTime(AppRec.PetitionApprovalDate.Year
564
                                            , AppRec.PetitionApprovalDate.Month, 1);
565
                }
566

  
567
                // 支払いデータ書込み
568
                if (!AddOrSetSalary(LedgerExDB
569
                                , CurRec.ConstructionCode, CurRec.GroupCount, CurRec.LineCount, Columncnt, OneDaySalary, ParaDate))
570
                {
571
                    return false;
572
                }
573

  
574
                return true;
575
            }
576
            catch (Exception ex)
577
            {
578
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
579
                return false;
580
            }
581
            finally
582
            {
583
                AppDB.close(); AppDB = null;
584
            }
585
        }
586
        #endregion
587

  
588 418
        #region 日次処理での日当の加算を判定する
589 419
        /// <summary>
590 420
        /// 日次処理での日当の加算を判定する
......
686 516
                StringBuilder strSQL = new StringBuilder();
687 517
                strSQL.Append("Select ConstructionCode, (MAX(DetailCount) + 1) As NewNo From constructionledgerdetail");
688 518
                strSQL.AppendFormat(" Where ConstructionCode = {0}", ConstrCode);
689
                strSQL.AppendFormat(" And GroupCount = {0}", (int)FrmConstructionLedger.DataGroup.ConstructionCosts);
519
                strSQL.AppendFormat(" And GroupCount = {0}", (int)ConstructionLedgerDetail.GroupCountDef.ConstructionCosts);
690 520

  
691 521
                ArrayList arList = new ArrayList();
692 522
                if (!DetailDB.ExecuteReader(strSQL.ToString(), ref arList, bConnect)) return 0;
......
704 534
        }
705 535
        #endregion
706 536

  
707
        // -----------------------------------
708
        // フルバージョン本体のみ ↓↓↓
709
        // -----------------------------------
537
        #region 工事詳細台帳実行データより最小カラムの対象年月日を取得する
538
        /// <summary>
539
        /// 工事詳細台帳実行データより最小カラムの対象年月日を取得する
540
        /// </summary>
541
        public static DateTime GetConstructionLedgerStartDate(IOConstructionLedgerExcute LedgerExcuteDB, int ConstrCode, bool bTableConnect = true)
542
        {
543
            try
544
            {
545
                // 工事詳細台帳実行データよりカラム対象の年月を取得する
546
                StringBuilder strCol = new StringBuilder();
547
                strCol.Append("SELECT MIN(ColumnCount), TargetMonth From constructionledgerexcute");
548
                strCol.AppendFormat(" Where ConstructionCode = {0}", ConstrCode);
549
                ArrayList arrCol = new ArrayList();
550
                if (!LedgerExcuteDB.ExecuteReader(strCol.ToString(), ref arrCol, bTableConnect)) return DateTime.MinValue;
551

  
552
                if (arrCol.Count < 1) return DateTime.MinValue;
553

  
554
                // 実行データが存在した場合は最小のカラムの年月スタートにする
555
                object[] wrkCol = (object[])arrCol[0];
556
                return CommonMotions.cnvDate(wrkCol[1]);
557
            }
558
            catch (Exception ex)
559
            {
560
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
561
                return DateTime.MinValue;
562
            }
563
        }
564
        #endregion
565

  
566
        #region 日付指定時の給与書込み
567
        /// <summary>
568
        /// 日付指定時の給与書込み
569
        /// </summary>
570
        private static bool CalcSalaryDevisionDaysInput(IOConstructionLedgerExcute LedgerExDB,
571
                                                        IOMPersonInCharge PersonDB,
572
                                                        ConstructionLedger LedgerRec,
573
                                                        ConstructionLedgerDetail CurRec)
574
        {
575
            IOProcessApproval AppDB = new IOProcessApproval();
576
            try
577
            {
578
                StringBuilder strSQL = new StringBuilder();
579

  
580

  
581

  
582
                // 月末日より月日数を取得する
583
                int MonthDayCnt = DateTimeUtil.EndOfMonth(LedgerRec.ConstructionStart).Day;
584
                int OneDaySalary = 0;
585
                int nSalaryDays = 0;
586
                // 支払給与計算
587
                switch (CurRec.GroupCount)
588
                {
589
                    case (int)ConstructionLedgerDetail.GroupCountDef.Instructor:       // 指導員給料
590
                        OneDaySalary = CommonMotions.cnvRound((double)CommonDefine.InstructorMonthryCost / MonthDayCnt);
591
                        break;
592
                    case (int)ConstructionLedgerDetail.GroupCountDef.Assistant:        // 副担当者給料
593
                        OneDaySalary = CommonMotions.cnvRound((double)CommonDefine.AssistantMonthryCost / MonthDayCnt);
594
                        OneDaySalary *= CurRec.SalaryDays;
595
                        break;
596
                    case (int)ConstructionLedgerDetail.GroupCountDef.Payroll:          // 担当者給料行
597
                        // 給与取得
598
                        OneDaySalary = CommonMotions.CalcElapsedSalary(PersonDB
599
                                                                        , LedgerRec.ConstructionStart
600
                                                                        , LedgerRec.ConstructionStart
601
                                                                        , CurRec.CompanyCode
602
                                                                        , false);
603
                        break;
604
                }
605

  
606

  
607
                OneDaySalary *= nSalaryDays;
608

  
609
                // 工事予算が承認された月の位置に書く
610
                strSQL.Clear();
611
                strSQL.Append(AppDB.CreatePrimarykeyString(CurRec.SourceCode,
612
                                                            3,                                      // 工事予算承認番号(ClsExecuteが無いため)
613
                                                            (int)CommonDefine.s_Default_OrderNo,
614
                                                            1));                                    // 先頭レコード
615
                strSQL.AppendFormat(" AND ApprovalStatus = {0}", (int)CommonDefine.ApprovalStatus.Approval);
616
                ProcessApproval AppRec = new ProcessApproval();
617
                if (!AppDB.SelectAction(strSQL.ToString(), ref AppRec)) return false;
618

  
619
                // 実行データのキー部年月日は開始月の1日
620
                DateTime ParaDate = new DateTime(LedgerRec.ConstructionStart.Year
621
                                                , LedgerRec.ConstructionStart.Month, 1);
622
                // 台帳カラム位置
623
                int Columncnt = Enum.GetNames(typeof(FrmConstructionLedger.GridColumn)).Length - 1;
624

  
625
                // 増減データは承認データを日付として使用する
626
                if ((CurRec.SourceCode % 10) > 1)
627
                {
628
                    DateTime dtStart = LedgerRec.ConstructionStart;
629
                    // 工事詳細台帳実行データよりカラム対象の年月を取得する
630
                    DateTime wrkDate = GetConstructionLedgerStartDate(LedgerExDB, CurRec.ConstructionCode, false);
631
                    if (wrkDate.Date != DateTime.MinValue.Date) dtStart = wrkDate;
632

  
633
                    // 承認日付より持ってくる
634
                    Columncnt = CalcTargetMonthToColumn(LedgerExDB, false, LedgerRec.ConstructionCode, AppRec.PetitionApprovalDate);
635
                    ParaDate = new DateTime(AppRec.PetitionApprovalDate.Year
636
                                            , AppRec.PetitionApprovalDate.Month, 1);
637
                }
638

  
639
                // 支払いデータ書込み
640
                if (!AddOrSetSalary(LedgerExDB
641
                                , CurRec.ConstructionCode, CurRec.GroupCount, CurRec.LineCount, Columncnt, OneDaySalary, ParaDate))
642
                {
643
                    return false;
644
                }
645

  
646
                return true;
647
            }
648
            catch (Exception ex)
649
            {
650
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
651
                return false;
652
            }
653
            finally
654
            {
655
                AppDB.close(); AppDB = null;
656
            }
657
        }
658
        #endregion
659

  
660
        #region 工事詳細台帳より支払金額グリッドの先頭カラム数を取得する
661
        /// <summary>
662
        /// 工事詳細台帳より支払金額グリッドの先頭カラム数を取得する
663
        /// </summary>
664
        public static int GetLedgerColumnCount()
665
        {
666
            try
667
            {
668
                return (Enum.GetNames(typeof(FrmConstructionLedger.GridColumn)).Length - 1);
669
            }
670
            catch (System.Exception ex)
671
            {
672
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
673
                return 0;
674
            }
675
        }
676
        #endregion
677

  
710 678
        #region 工事詳細台帳データを新規作成する
711 679
        /// <summary>
712 680
        /// 工事詳細台帳データを新規作成する
......
1039 1007
        }
1040 1008
        #endregion
1041 1009

  
1042
        #region 工事詳細台帳実行データより最小カラムの対象年月日を取得する
1043
        /// <summary>
1044
        /// 工事詳細台帳実行データより最小カラムの対象年月日を取得する
1045
        /// </summary>
1046
        public static DateTime GetConstructionLedgerStartDate(IOConstructionLedgerExcute LedgerExcuteDB, int ConstrCode, bool bTableConnect = true)
1047
        {
1048
            try
1049
            {
1050
                // 工事詳細台帳実行データよりカラム対象の年月を取得する
1051
                StringBuilder strCol = new StringBuilder();
1052
                strCol.Append("SELECT MIN(ColumnCount), TargetMonth From constructionledgerexcute");
1053
                strCol.AppendFormat(" Where ConstructionCode = {0}", ConstrCode);
1054
                ArrayList arrCol = new ArrayList();
1055
                if (!LedgerExcuteDB.ExecuteReader(strCol.ToString(), ref arrCol, bTableConnect)) return DateTime.MinValue;
1056

  
1057
                if (arrCol.Count < 1) return DateTime.MinValue;
1058

  
1059
                // 実行データが存在した場合は最小のカラムの年月スタートにする
1060
                object[] wrkCol = (object[])arrCol[0];
1061
                return CommonMotions.cnvDate(wrkCol[1]);
1062
            }
1063
            catch (Exception ex)
1064
            {
1065
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
1066
                return DateTime.MinValue;
1067
            }
1068
        }
1069
        #endregion
1070

  
1071 1010
        #region 結合工事作成処理
1072 1011
        /// <summary>
1073 1012
        /// 結合工事作成処理
......
1196 1135

  
1197 1136
                StringBuilder strSQL = new StringBuilder();
1198 1137

  
1199
                int GroupNo = (int)FrmConstructionLedger.DataGroup.ConstructionCosts;
1138
                int GroupNo = (int)ConstructionLedgerDetail.GroupCountDef.ConstructionCosts;
1200 1139

  
1140
                double decParcent = (100.0 - CommonMotions.SystemMasterData.StatutoryWelfareRate) / 100.0;
1201 1141
                strSQL.Append("Select");
1202 1142
                strSQL.Append(" A.ConstructionCode,");
1203 1143
                strSQL.Append(" A.CompanyCode,");
1204 1144
                strSQL.Append(" A.ExecutionAmount,");
1205 1145
                strSQL.Append(" SUM(ifnull(B.PaymentAmount, 0)), ");
1206
                strSQL.Append(" Round((Ifnull(Odr.OrdersLinePrice, 0) / (100.0 - ifnull(Odr2.StatutoryWelfareRate, 0))) * 100.0, 0) As OrderPrice");
1146
                strSQL.AppendFormat(" Round((Ifnull(Odr.OrdersLinePrice, 0) / {0}), 0) As OrderPrice", decParcent);
1207 1147

  
1208 1148
                strSQL.Append(" From constructionledgerdetail AS A");
1209 1149

  
......
1218 1158
                strSQL.Append("           And Odr.SourceDetailCnt = A.DetailCount");
1219 1159
                strSQL.AppendFormat("     And Odr.GroupCount = {0}", (int)PurchaseOrderDetail.GroupCountDef.Detail);
1220 1160
                strSQL.Append("           And A.DetailCount > 0");
1221
                strSQL.Append("      LEFT JOIN PurchaseOrderDetail As Odr2");
1222
                strSQL.Append("           ON Odr2.ConstructionCode = Odr.ConstructionCode");
1223
                strSQL.Append("           And Odr2.SeqNo = Odr.SeqNo");
1224
                strSQL.AppendFormat("     And Odr2.GroupCount = {0}", (int)PurchaseOrderDetail.GroupCountDef.StatutoryWelfare);
1225 1161

  
1226 1162
                strSQL.AppendFormat(" WHERE A.ConstructionCode = {0}", ConstrCode);
1227 1163
                strSQL.AppendFormat(" AND A.GroupCount = {0}", GroupNo);
......
1236 1172
                int ExecValue = CommonMotions.cnvInt(objRec[2]);
1237 1173
                int PaymentValue = CommonMotions.cnvInt(objRec[3]);
1238 1174
                int OrderValue = CommonMotions.cnvInt(objRec[4]);
1175
                // 発注金額が無ければ予算金額をセットする
1176
                if (OrderValue <= 0) OrderValue = ExecValue;
1239 1177

  
1240
                //// 登録値+入力値が実行金額を超えた場合はfalseを返す
1241
                //if (ExecValue < (PaymentValue + CurrentValue)) return false;
1242 1178
                // 登録値+入力値が発注金額を超えた場合はfalseを返す
1243
                if (OrderValue < (PaymentValue + CurrentValue)) return false;
1179
                if (OrderValue < (PaymentValue + CurrentValue))
1180
                {
1181
                    // 入力値が0の場合はエラーにしない
1182
                    if (CurrentValue == 0) return true;
1244 1183

  
1184
                    // 予算がプラスの場合は超過(マイナス時には超過にしない)
1185
                    if (ExecValue > 0) return false;
1186
                }
1187

  
1245 1188
                return true;
1246 1189
            }
1247 1190
            catch (System.Exception ex)
trunk/src/ProcessManagement/ProcessManagement/Common/Process/ClsConvertCode.cs
77 77
                    case (int)ClsExcute.ApprovalListNo.GoOut:                               // 23:外 出➝5:外 出
78 78
                        nAppNo = (int)AttendanceDailyData.WorkKindFlgDef.GoOut;
79 79
                        break;
80
                    case (int)ClsExcute.ApprovalListNo.UniqueDay:                           // 25:特殊休暇➝12:特殊休
81
                        nAppNo = (int)AttendanceDailyData.WorkKindFlgDef.UniqueDay;
82
                        break;
80 83
                }
81 84

  
82 85
                return nAppNo;
......
130 133
                    case (int)AttendanceDailyData.WorkKindFlgDef.CompensatoryHoliday:       // 10:代 休➝18:代 休
131 134
                        nAppNo = (int)ClsExcute.ApprovalListNo.CompensatoryHoliday;
132 135
                        break;
136
                    case (int)AttendanceDailyData.WorkKindFlgDef.UniqueDay:                 // 12:特殊休➝18:特殊休暇休
137
                        nAppNo = (int)ClsExcute.ApprovalListNo.UniqueDay;
138
                        break;
133 139
                }
134 140

  
135 141
                return nAppNo;
trunk/src/ProcessManagement/ProcessManagement/Common/Process/ClsExcute.cs
101 101
            WorkingPrint = 54,                  // 54:出勤管理日報印刷
102 102
            OnHandVolume = 55,                  // 55:手持工事高一覧
103 103
            DRNoticeCalender = 56,              // 56:勤怠届カレンダー
104
            PurchaseOrderList = 57,             // 57:注文書入力一覧
104 105
        }
105 106
        #endregion
106 107

  
......
281 282
                                                                                { (int)ProcessExecuteNo.WorkingPrint,           "出勤管理日報-印刷" },
282 283
                                                                                { (int)ProcessExecuteNo.OnHandVolume,           "手持工事高-印刷" },
283 284
                                                                                { (int)ProcessExecuteNo.DRNoticeCalender,       "勤怠届カレンダー-表示" },
285
                                                                                { (int)ProcessExecuteNo.PurchaseOrderList,      "注文書入力一覧-表示" },
284 286
                                                                                };
285 287

  
286 288
        #endregion
......
347 349
                                                                                };
348 350
        #endregion
349 351

  
350
        #region 承認処理定義
352
        #region 承認処理定義一覧
351 353
        /// <summary>
352
        /// 承認一覧
354
        /// 承認処理定義一覧
353 355
        /// </summary>
354 356
        public enum ApprovalListNo
355 357
        {
......
453 455
            /// 24:請求取消
454 456
            /// </summary>
455 457
            OrderRequestCancel,
458
            /// <summary>
459
            /// 25:特殊休暇
460
            /// </summary>
461
            UniqueDay,
456 462
        }
457 463
        #endregion
458 464

  
......
504 510
                                                                                { (int)ApprovalListNo.Late,                         "遅刻承認" },
505 511
                                                                                { (int)ApprovalListNo.LeaveEarly,                   "早退承認" },
506 512
                                                                                { (int)ApprovalListNo.GoOut,                        "外出承認" },
507
                                                                                { (int)ApprovalListNo.OrderRequestCancel,           "請求取消" },
513
                                                                                { (int)ApprovalListNo.OrderRequestCancel,           "請求取消承認" },
514
                                                                                { (int)ApprovalListNo.UniqueDay,                    "特殊休暇承認" },
508 515
                                                                                };
509 516

  
510 517
        #endregion
......
859 866
                            ProcessExecuteNo_OnHandVolume(m_ProcControlPara[NowPoint]);
860 867
                            break;
861 868

  
862
                        case (int)ProcessExecuteNo.DRNoticeCalender:                      // 56:勤怠届カレンダー
869
                        case (int)ProcessExecuteNo.DRNoticeCalender:                    // 56:勤怠届カレンダー
863 870
                            ProcessExecuteNo_DRWorkCalender(m_ProcControlPara[NowPoint]);
864 871
                            break;
865 872

  
873
                        case (int)ProcessExecuteNo.PurchaseOrderList:                   // 57:注文書入力一覧
874
                            ProcessExecuteNo_PurchaseOrderList(m_ProcControlPara[NowPoint]);
875
                            break;
876

  
866 877
                        #endregion
867 878

  
868 879
                        #region マスタメンテ
......
1232 1243
            finally
1233 1244
            {
1234 1245
                frm.Dispose(); frm = null;
1235
                ClsExcute.SubFormHandleList[ProcessNo].ProcessNo = (int)ClsExcute.ProcessExecuteNo.MainMenu;
1236
                ClsExcute.SubFormHandleList[ProcessNo].SubFormHandle = null;
1237 1246
            }
1238 1247
        }
1239 1248
        #endregion
......
1273 1282
            finally
1274 1283
            {
1275 1284
                frm.Dispose(); frm = null;
1276
                ClsExcute.SubFormHandleList[ProcessNo].ProcessNo = (int)ClsExcute.ProcessExecuteNo.MainMenu;
1277
                ClsExcute.SubFormHandleList[ProcessNo].SubFormHandle = null;
1278 1285
            }
1279 1286
        }
1280 1287
        #endregion
......
1315 1322
            finally
1316 1323
            {
1317 1324
                frm.Dispose(); frm = null;
1318
                ClsExcute.SubFormHandleList[ProcessNo].ProcessNo = (int)ClsExcute.ProcessExecuteNo.MainMenu;
1319
                ClsExcute.SubFormHandleList[ProcessNo].SubFormHandle = null;
1320 1325
            }
1321 1326
        }
1322 1327
        #endregion
......
1395 1400
            finally
1396 1401
            {
1397 1402
                frm.Dispose(); frm = null;
1398
                ClsExcute.SubFormHandleList[ProcessNo].ProcessNo = (int)ClsExcute.ProcessExecuteNo.MainMenu;
1399
                ClsExcute.SubFormHandleList[ProcessNo].SubFormHandle = null;
1400 1403
            }
1401 1404
        }
1402 1405
        #endregion
......
1442 1445
                    frm.DirectFlg = CurrentPara.BoolExecParameter[0];
1443 1446
                    if (CurrentPara.BoolExecParameter.Count > 1)
1444 1447
                    {
1445
                        /// 新規申請フラグ
1448
                        // 新規申請フラグ
1446 1449
                        frm.NewApprovalFlg = CurrentPara.BoolExecParameter[1];
1447 1450
                    }
1448 1451
                }
......
1458 1461
            finally
1459 1462
            {
1460 1463
                frm.Dispose(); frm = null;
1461
                ClsExcute.SubFormHandleList[ProcessNo].ProcessNo = (int)ClsExcute.ProcessExecuteNo.MainMenu;
1462
                ClsExcute.SubFormHandleList[ProcessNo].SubFormHandle = null;
1463 1464
            }
1464 1465
        }
1465 1466
        #endregion
......
1501 1502
            finally
1502 1503
            {
1503 1504
                frm.Dispose(); frm = null;
1504
                ClsExcute.SubFormHandleList[ProcessNo].ProcessNo = (int)ClsExcute.ProcessExecuteNo.MainMenu;
1505
                ClsExcute.SubFormHandleList[ProcessNo].SubFormHandle = null;
1506 1505
            }
1507 1506
        }
1508 1507
        #endregion
......
1661 1660
            finally
1662 1661
            {
1663 1662
                frm.Dispose(); frm = null;
1664
                ClsExcute.SubFormHandleList[ProcessNo].ProcessNo = (int)ClsExcute.ProcessExecuteNo.MainMenu;
1665
                ClsExcute.SubFormHandleList[ProcessNo].SubFormHandle = null;
1666 1663
            }
1667 1664
        }
1668 1665
        #endregion
......
1707 1704
            finally
1708 1705
            {
1709 1706
                frm.Dispose(); frm = null;
1710
                ClsExcute.SubFormHandleList[ProcessNo].ProcessNo = (int)ClsExcute.ProcessExecuteNo.MainMenu;
1711
                ClsExcute.SubFormHandleList[ProcessNo].SubFormHandle = null;
1712 1707
            }
1713 1708
        }
1714 1709
        #endregion
......
1803 1798
            finally
1804 1799
            {
1805 1800
                frm.Dispose(); frm = null;
1806
                ClsExcute.SubFormHandleList[ProcessNo].ProcessNo = (int)ClsExcute.ProcessExecuteNo.MainMenu;
1807
                ClsExcute.SubFormHandleList[ProcessNo].SubFormHandle = null;
1808 1801
            }
1809 1802
        }
1810 1803
        #endregion
......
1848 1841
            finally
1849 1842
            {
1850 1843
                frm.Dispose(); frm = null;
1851
                ClsExcute.SubFormHandleList[ProcessNo].ProcessNo = (int)ClsExcute.ProcessExecuteNo.MainMenu;
1852
                ClsExcute.SubFormHandleList[ProcessNo].SubFormHandle = null;
1853 1844
            }
1854 1845
        }
1855 1846
        #endregion
......
2098 2089
            finally
2099 2090
            {
2100 2091
                frm.Dispose(); frm = null;
2101
                ClsExcute.SubFormHandleList[ProcessNo].ProcessNo = (int)ClsExcute.ProcessExecuteNo.MainMenu;
2102
                ClsExcute.SubFormHandleList[ProcessNo].SubFormHandle = null;
2103 2092
            }
2104 2093
        }
2105 2094
        #endregion
......
2444 2433
            finally
2445 2434
            {
2446 2435
                frm.Dispose(); frm = null;
2447
                ClsExcute.SubFormHandleList[ProcessNo].ProcessNo = (int)ClsExcute.ProcessExecuteNo.MainMenu;
2448
                ClsExcute.SubFormHandleList[ProcessNo].SubFormHandle = null;
2449 2436
            }
2450 2437
        }
2451 2438
        #endregion
......
2515 2502
                }
2516 2503

  
2517 2504
                // 次起動プロセスセット
2518
                frm.ExecuteFlg = CurrentPara.IntExecParameter[0];
2519
                frm.ExecuteSubFlg = CurrentPara.IntExecParameter[1];
2520
                frm.RequestMonth = CurrentPara.IntExecParameter[2];
2521
                frm.OrderersDivision = CurrentPara.IntExecParameter[3];
2522
                frm.OrderersCode = CurrentPara.IntExecParameter[4];
2505
                if (CurrentPara.IntExecParameter.Count > 0) frm.ExecuteFlg = CurrentPara.IntExecParameter[0];
2506
                if (CurrentPara.IntExecParameter.Count > 1) frm.ExecuteSubFlg = CurrentPara.IntExecParameter[1];
2507
                if (CurrentPara.IntExecParameter.Count > 2) frm.RequestMonth = CurrentPara.IntExecParameter[2];
2508
                if (CurrentPara.IntExecParameter.Count > 3) frm.OrderersDivision = CurrentPara.IntExecParameter[3];
2509
                if (CurrentPara.IntExecParameter.Count > 4) frm.OrderersCode = CurrentPara.IntExecParameter[4];
2523 2510

  
2524
                frm.OrderersName = CurrentPara.StringExecParameter[0];
2511
                if (CurrentPara.StringExecParameter.Count > 0) frm.OrderersName = CurrentPara.StringExecParameter[0];
2525 2512

  
2526 2513
                frm.EditFlg = true;
2527 2514

  
......
3290 3277
            finally
3291 3278
            {
3292 3279
                frm.Dispose(); frm = null;
3293
                ClsExcute.SubFormHandleList[ProcessNo].ProcessNo = (int)ClsExcute.ProcessExecuteNo.MainMenu;
3294
                ClsExcute.SubFormHandleList[ProcessNo].SubFormHandle = null;
3295 3280
            }
3296 3281
        }
3297 3282
        #endregion
3298 3283

  
3284
        #region 注文書入力一覧
3285
        /// <summary>
3286
        /// 注文書入力一覧
3287
        /// </summary>
3288
        /// <returns></returns>
3289
        public static void ProcessExecuteNo_PurchaseOrderList(ProcessParameter CurrentPara)
3290
        {
3291
            // 注文書入力一覧
3292
            FrmOrderEntryList frm = new FrmOrderEntryList();
3293
            int ProcessNo = (int)ClsExcute.ProcessExecuteNo.PurchaseOrderList;
3294
            try
3295
            {
3296
                // 自分のハンドルをリストへセットする
3297
                ClsExcute.SubFormHandleList[ProcessNo].ProcessNo = ProcessNo;
3298
                ClsExcute.SubFormHandleList[ProcessNo].SubFormHandle = (Form)frm;
3299

  
3300
                // 起動・編集フラグ
3301
                int EditFlg = (int)CommonDefine.ProcessDataEdit.Reference;
3302
                ClsSecurityPermission.GetExecutePermission(ProcessNo, ref EditFlg);
3303
                if (EditFlg == (int)CommonDefine.ProcessDataEdit.Reference) frm.EditLock = true;
3304

  
3305
                // ----- パラメータセット
3306
                // 工事番号
3307
                frm.ConstructionCode = CurrentPara.IntExecParameter[0];
3308

  
3309
                // 新規申請フラグ
3310
                if (CurrentPara.BoolExecParameter.Count > 0)
3311
                    frm.NewApprovalFlg = CurrentPara.BoolExecParameter[0];
3312

  
3313
                // フォーム表示
3314
                frm.ShowDialog();
3315
            }
3316
            catch (Exception ex)
3317
            {
3318
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
3319
                BackProcess();
3320
            }
3321
            finally
3322
            {
3323
                frm.Dispose(); frm = null;
3324
            }
3325
        }
3299 3326
        #endregion
3300 3327

  
3328
        #endregion
3329

  
3301 3330
        #region マスタメンテナンス
3302 3331
        // ----------------- メンテナンス起動
3303 3332
        #region 管理マスタ
trunk/src/ProcessManagement/ProcessManagement/Common/Process/ClsMoveDepOfInfo.cs
491 491
                }
492 492
                strSQL.Append(" )");
493 493

  
494
                strSQL.AppendFormat(" And GroupCount in ({0}, {1}, {2})",(int)FrmConstructionLedger.DataGroup.Instructor
495
                                                                        , (int)FrmConstructionLedger.DataGroup.Assistant
496
                                                                        , (int)FrmConstructionLedger.DataGroup.Payroll);
494
                strSQL.AppendFormat(" And GroupCount in ({0}, {1}, {2})",(int)ConstructionLedgerDetail.GroupCountDef.Instructor
495
                                                                        , (int)ConstructionLedgerDetail.GroupCountDef.Assistant
496
                                                                        , (int)ConstructionLedgerDetail.GroupCountDef.Payroll);
497 497
                strSQL.AppendFormat(" And CompanyCode = {0}", PersonCode);
498 498

  
499 499
                if (!LedgerDB.ExecuteNonQuery(strSQL.ToString(), false)) return false;
trunk/src/ProcessManagement/ProcessManagement/Common/Process/ClsOtherProc.cs
811 811
        /// <summary>
812 812
        /// 起動フォーム登録
813 813
        /// </summary>
814
        private static void ExecFormEntry(int ProcessNo, int CurProcNo, Form CurForm)
814
        public static void ExecFormEntry(int ProcessNo, int CurProcNo, Form CurForm)
815 815
        {
816 816
            try
817 817
            {
trunk/src/ProcessManagement/ProcessManagement/Common/Process/ClsSystemOnceExecute.cs
376 376
                WriteData.MessageColor = CheckRec.ForeColor;                                                // 背景色セット
377 377

  
378 378
                // 掲示板対象者テーブル
379
                MessageBoardTerget DetailTbl = new MessageBoardTerget();
380
                DetailTbl.ToCode = ConstructionPersonCode;                                                  // 対象者コード
381
                DetailTbl.ToName = ConstructionPersonName;	                                                // 対象者
379
                MessageBoardTerget DetailTbl = new MessageBoardTerget
380
                {
381
                    ToCode = ConstructionPersonCode,                                                  // 対象者コード
382
                    ToName = ConstructionPersonName                                                 // 対象者
383
                };
382 384
                WriteDetail.Add(DetailTbl);
383 385

  
384 386
                // メッセージフラグを自動に設定する
......
692 694
                strSQL.Append(" Where");
693 695
                strSQL.AppendFormat(" B1.ConstructionCode = {0}", nConstrCode);
694 696

  
695
                // ----- 定義がClsExcuteクラスにあるためマジックナンバー
696
                // ----- 3は工事予算承認が承認されていればOK
697
                strSQL.Append(" And B1.ApprovalCode = 3");
697
                // ----- 工事予算承認が承認されていればOK
698
                strSQL.AppendFormat(" And B1.ApprovalCode = {0}", (int)ClsExcute.ApprovalListNo.ConstructionBudgetApproval);
698 699
                strSQL.Append(" And B1.SeqNo = 1");
699 700
                strSQL.AppendFormat(" And B1.ApprovalStatus = {0}", (int)CommonDefine.ApprovalStatus.Approval);
700 701

  
......
930 931
                WriteData.MessageColor = CheckRec.ForeColor;                                                // 背景色セット
931 932

  
932 933
                // 掲示板対象者テーブル
933
                MessageBoardTerget DetailTbl = new MessageBoardTerget();
934
                DetailTbl.ToCode = SalesPersonCode;                                                     // 対象者コード
935
                DetailTbl.ToName = SalesPersonName;	                                                    // 対象者
934
                MessageBoardTerget DetailTbl = new MessageBoardTerget
935
                {
936
                    ToCode = SalesPersonCode,                                                     // 対象者コード
937
                    ToName = SalesPersonName                                                        // 対象者
938
                };
936 939
                if (ConstructionPersonCode != 0)
937 940
                {
938 941
                    DetailTbl.ToCode = ConstructionPersonCode;                                          // 対象者コード
......
1078 1081
        {
1079 1082
            try
1080 1083
            {
1081
                ConstructionBaseInfoDetail work = new ConstructionBaseInfoDetail();
1082
                work.ConstructionCode = ConstrCode;
1083
                work.DetailNo = (int)ConstructionBaseInfoDetail.DataNoDef.OrdersDecisionComment;
1084
                work.DetailString = strMsg;
1084
                ConstructionBaseInfoDetail work = new ConstructionBaseInfoDetail
1085
                {
1086
                    ConstructionCode = ConstrCode,
1087
                    DetailNo = (int)ConstructionBaseInfoDetail.DataNoDef.OrdersDecisionComment,
1088
                    DetailString = strMsg
1089
                };
1085 1090

  
1086 1091
                if (!DetailDB.InsertAction(work, false)) return false;
1087 1092

  
......
1397 1402
                        return false;
1398 1403
                    }
1399 1404

  
1400
                    BizPeriodHistory BizHisRec = new BizPeriodHistory();
1401
                    BizHisRec.PeriodYear = nData;               // 営業期数・工事年度
1402
                    BizHisRec.PeriodFlag = nPeriodFlag;         // 営業期数・工事年度フラグ
1405
                    BizPeriodHistory BizHisRec = new BizPeriodHistory
1406
                    {
1407
                        PeriodYear = nData,               // 営業期数・工事年度
1408
                        PeriodFlag = nPeriodFlag,         // 営業期数・工事年度フラグ
1403 1409

  
1404
                    BizHisRec.BeginDate = dtData[0];            // 期首日
1405
                    BizHisRec.CompleteDate = dtData[1];         // 期末日
1410
                        BeginDate = dtData[0],            // 期首日
1411
                        CompleteDate = dtData[1]         // 期末日
1412
                    };
1406 1413

  
1407 1414
                    if (BizHisList.Count < 1)
1408 1415
                    {
......
1664 1671
                if (!SystemDB.SelectAction(strSQL.ToString(), ref SysRec)) return false;
1665 1672

  
1666 1673
                // 期末のみ処理を行う
1667
                if ((int)SystemMaster.ConstrNoBaseDef.BusinessPeriod == SysRec.ConstructionNoBase)
1674
                int nYear = DateTime.Today.Year;
1675
                int nMonth = DateTime.Today.Month;
1676
                if (CommonMotions.BasePeriodYear())
1668 1677
                {
1669 1678
                    // 期を選択している場合
1670
                    if (DateTime.Today.AddDays(-1).Date != SysRec.BusinessCompDate.Date) return true;
1679
                    if (DateTime.Today.Date != SysRec.BusinessCompDate.Date) return true;
1680
                    nMonth = (SysRec.BusinessCompDate.Month + 1);
1671 1681
                }
1672 1682
                else
1673 1683
                {
1674 1684
                    // 年を選択している場合
1675
                    if (DateTime.Today.AddDays(-1).Date != SysRec.ConstrBeginDate.Date) return true;
1685
                    if (DateTime.Today.Date != SysRec.ConstrCompDate.Date) return true;
1686
                    nMonth = (SysRec.ConstrCompDate.Month + 1);
1676 1687
                }
1677 1688

  
1678 1689
                DateDB.connect();DateDB.beginTran();
1679 1690

  
1680 1691
                // 当月の25日開始、翌月5日のデータを1年分作成する
1681
                DateTime dtWrkYM = new DateTime(2019, 4, 1);
1682
                DateTime dtWrkYM2 = new DateTime(2019, 4, 1);
1692
                DateTime dtWrkYM = new DateTime(nYear, nMonth, 1);
1693
                DateTime dtWrkYM2 = new DateTime(nYear, nMonth, 1);
1683 1694
                DateTime[] dateTime = new DateTime[2];
1684 1695
                ClosingDateOfMonth DateRec = new ClosingDateOfMonth();
1685 1696
                for (int ix = 0; ix < 12; ix++)
......
1765 1776
            try
1766 1777
            {
1767 1778
                // 定数取得
1768
                List<decimal> PaidHolidayTable = new List<decimal> { 10, 11, 12, 14, 16, 18, 20 };
1779
                //List<decimal> PaidHolidayTable = new List<decimal> { 10, 11, 12, 14, 16, 18, 20 };    2020/4/20 Commondefineへ移動
1780
                // 半年後
1769 1781
                int nAddMonth = 6;
1782
                // 加算年
1770 1783
                int nAddYear = 1;
1771 1784

  
1772 1785
                StringBuilder strSQL = new StringBuilder();
......
1801 1814
                        // ループカウントの最終回は無条件に処理する
1802 1815
                        // 年が今年の時に処理を行う
1803 1816
                        DateTime dtWork = dtTarget.AddYears((ix * nAddYear));
1804
                        if (ix < (PaidHolidayTable.Count - 1)
1817
                        if (ix < (CommonDefine.PaidHolidayTable.Count - 1)
1805 1818
                            && dtWork.Year != DateTime.Today.Year) continue;
1806 1819

  
1807 1820
                        // 当年残日数取得
......
1812 1825
                        if (nZen < 0)
1813 1826
                        {
1814 1827
                            strSQL.Append(" SET PaidVacationDaysPrev = 0");
1815
                            strSQL.AppendFormat(", PaidVacationDays = {0}", (PaidHolidayTable[ix] + nZen));
1828
                            strSQL.AppendFormat(", PaidVacationDays = {0}", (CommonDefine.PaidHolidayTable[ix] + nZen));
1816 1829
                        }
1817 1830
                        else
1818 1831
                        {
1819 1832
                            strSQL.Append(" SET PaidVacationDaysPrev = PaidVacationDays");
1820
                            strSQL.AppendFormat(", PaidVacationDays = {0}", PaidHolidayTable[ix]);
1833
                            strSQL.AppendFormat(", PaidVacationDays = {0}", CommonDefine.PaidHolidayTable[ix]);
1821 1834
                        }
1822 1835
                        strSQL.Append("      , UpdateDate = NOW()");
1823 1836
                        strSQL.AppendFormat(" Where PersonCode = {0}", nManNo);
trunk/src/ProcessManagement/ProcessManagement/Common/ProductDefine.cs
183 183
        /// <summary>
184 184
        /// 製品種別
185 185
        /// </summary>
186
        private static int m_ProductType = (int)ProductTypeDef.ProductsModelType3;
186
        private static int m_ProductType = (int)ProductTypeDef.ProductsModelType1;
187 187
        #endregion
188 188

  
189 189
        #region 更新機能実装
......
204 204
        /// <summary>
205 205
        /// DBサーバータイプ
206 206
        /// </summary>
207
        private static int m_StorageType = (int)StorageTypeDef.VPS;
207
        private static int m_StorageType = (int)StorageTypeDef.Internal_LAN;
208 208
        #endregion
209 209

  
210 210
        #region バッチ処理起動タイプ
211 211
        /// <summary>
212 212
        /// バッチ処理起動タイプ
213 213
        /// </summary>
214
        private static int m_BatchProcessing = (int)BatchProcessingDef.Server;
214
        private static int m_BatchProcessing = (int)BatchProcessingDef.Loacl;
215 215
        #endregion
216 216

  
217 217
        #endregion
trunk/src/ProcessManagement/ProcessManagement/DB/IOAccess/IOBillingCostDataLink.cs
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
using System.Collections;
6

  
7
using log4net;
8
using MySql.Data.MySqlClient;
9

  
10
using ProcessManagement.DB.MySql;
11
using ProcessManagement.DB.Core;
12
using ProcessManagement.DataModel;
13

  
14
using ProcessManagement.Common;
15

  
16
namespace ProcessManagement.DB.IOAccess
17
{
18
    /// <summary>
19
    /// 業者請求部署出納リンクデータクラス
20
    /// </summary>
21
    public class IOBillingCostDataLink: MySqlProcess
22
    {
23
        #region 定義部
24
        /// <summary>
25
        /// log4netログを使用する
26
        /// </summary>
27
        private static readonly ILog logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
28
        #endregion
29

  
30
        #region 定数
31
        /// <summary>
32
        /// フィールド並び
33
        /// </summary>
34
        public enum NameColumn
35
        {
36
            CompanyCode = 0,
37
            TargetDate,
38
            SeqNoB,
39
            LineCount,
40
            LabourKind,
41
            YearNumber,
42
            CostType,
43
            TargetType,
44
            TargetCode,
45
            SeqNoC,
46
            EntryDate,
47
            UpdateDate,
48
        }
49
        #endregion
50

  
51
        #region コンストラクタ
52
        /// <summary>
53
        /// コンストラクタ
54
        /// </summary>
55
        /// <param name="ConnectionString"></param>
56
        public IOBillingCostDataLink()
57
            : base(DBCommon.Instance.DBConnectString)
58
        {
59
        }
60

  
61
        #endregion
62

  
63
        #region 承認データ検索文字列作成
64
        /// <summary>
65
        /// 承認データ検索文字列作成
66
        /// </summary>
67
        private string CreateSelectSQL()
68
        {
69
            StringBuilder strcmd = new StringBuilder();
70
            strcmd.Append("SELECT");
71

  
72
            bool bColFirst = true;
73
            string strWork = string.Empty;
74
            foreach (var gender in Enum.GetValues(typeof(NameColumn)))
75
            {
76
                strWork = gender.ToString();
77
                if (!bColFirst) strcmd.Append(",");
78
                if (strWork.Equals("EntryDate") || strWork.Equals("UpdateDate"))
79
                {
80
                    strcmd.AppendFormat(" DATE_FORMAT({0}, '%Y/%m/%d %H:%i:%s')", strWork);
81
                }
82
                else
83
                {
84
                    strcmd.AppendFormat(" {0}", strWork);
85
                }
86
                bColFirst = false;
87
            }
88

  
89
            strcmd.Append(" FROM BillingCostDataLink");
90

  
91
            return strcmd.ToString();
92
        }
93
        #endregion
94

  
95
        #region 検索(複数)
96
        /// <summary>
97
        /// 検索(複数)
98
        /// </summary>
99
        public bool SelectAction(string AddSQLString, ref List<BillingCostDataLink> data, bool bConnect = true)
100
        {
101
            // インターフェース
102
            StringBuilder strcmd = new StringBuilder();
103
            ArrayList arData = new ArrayList();
104

  
105
            try
106
            {
107
                // SQL作成
108
                strcmd.Append(CreateSelectSQL());
109
                strcmd.Append(AddSQLString);
110

  
111
                // SQL実行
112
                if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return false;
113

  
114
                // データセット
115
                foreach (object[] objwrk in arData)
116
                {
117
                    BillingCostDataLink work = new BillingCostDataLink();
118
                    Reader2Struct(objwrk, ref work);
119
                    data.Add(work);
120
                }
121

  
122
                return true;
123
            }
124
            catch (Exception ex)
125
            {
126
                logger.ErrorFormat("システムエラー::{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
127
                return false;
128
            }
129

  
130
        }
131
        #endregion
132

  
133
        #region 検索(1件)
134
        /// <summary>
135
        /// 検索(1件)
136
        /// </summary>
137
        public bool SelectAction(string AddSQLString, ref BillingCostDataLink data, bool bConnect = true)
138
        {
139
            // インターフェース
140
            StringBuilder strcmd = new StringBuilder();
141
            ArrayList arData = new ArrayList();
142

  
143
            try
144
            {
145
                // SQL作成
146
                strcmd.Append(CreateSelectSQL());
147
                strcmd.Append(AddSQLString);
148

  
149
                // SQL実行
150
                if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return false;
151

  
152
                // データセット
153
                object[] objwrk = (object[])arData[0];
154
                Reader2Struct(objwrk, ref data);
155

  
156
                return true;
157
            }
158
            catch (Exception ex)
159
            {
160
                logger.ErrorFormat("システムエラー::{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
161
                return false;
162
            }
163

  
164
        }
165
        #endregion
166

  
167
        #region 新規登録(1件)
168
        /// <summary>
169
        /// 新規登録(1件)
170
        /// </summary>
171
        public bool InsertAction(BillingCostDataLink work, bool bConnect = true)
172
        {
173
            StringBuilder strcmd = new StringBuilder();
174
            try
175
            {
176

  
177
                strcmd.Clear();
178
                strcmd.Append("INSERT INTO BillingCostDataLink");
179

  
180
                strcmd.Append("(");
181
                bool bFirst = true;
182
                foreach (var gender in Enum.GetValues(typeof(NameColumn)))
183
                {
184
                    if (!bFirst) strcmd.Append(", ");
185
                    strcmd.Append(gender.ToString());
186
                    bFirst = false;
187
                }
188
                strcmd.Append(") VALUES (");
189

  
... 差分の行数が表示可能な上限を超えました。超過分は表示しません。

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