リビジョン 485
製品化第1版
trunk/src/DataCheckExcute/DataCheckExcute/Common/Process/ClsChangeLedgerData.cs | ||
---|---|---|
51 | 51 |
/// 工事詳細台帳再計算処理(総支払額・粗利・給与・純利益が対象) |
52 | 52 |
/// </summary> |
53 | 53 |
/// <param name="ConstrCode"></param> |
54 |
private static bool LedgerRecalculate(IOConstructionLedgerExcute LedgerExcuteDB, List<int> ConstrCodeList)
|
|
54 |
public static bool LedgerRecalculate(IOConstructionLedgerExcute LedgerExcuteDB, List<int> ConstrCodeList)
|
|
55 | 55 |
{ |
56 | 56 |
try |
57 | 57 |
{ |
58 | 58 |
StringBuilder strSQL = new StringBuilder(); |
59 | 59 |
bool bRet = true; |
60 | 60 |
|
61 |
// 対象データ取得 |
|
62 |
List<int> GroupCodeList1 = new List<int>(); |
|
63 |
List<int> GroupCodeList2 = new List<int>(); |
|
64 |
List<int> GroupCodeList3 = new List<int>(); |
|
65 |
List<int> GroupCodeList4 = new List<int>(); |
|
66 |
// 集計コード一覧作成 |
|
67 |
SetGroupCodeList(ref GroupCodeList1, ref GroupCodeList2, ref GroupCodeList3, ref GroupCodeList4); |
|
68 |
|
|
69 | 61 |
foreach (int ConstrCode in ConstrCodeList) |
70 | 62 |
{ |
71 | 63 |
// 工事台帳実行データよりグループごとの合計金額を取得する |
72 | 64 |
strSQL.Clear(); |
73 |
strSQL.Append("SELECT GROUPCOUNT, SUM(PAYMENTAMOUNT)"); |
|
65 |
strSQL.Append("SELECT"); |
|
66 |
strSQL.Append(" GROUPCOUNT"); |
|
67 |
strSQL.Append(", SUM(PAYMENTAMOUNT)"); |
|
74 | 68 |
strSQL.Append(" FROM CONSTRUCTIONLEDGEREXCUTE"); |
75 |
strSQL.AppendFormat(" WHERE CONSTRUCTIONCODE = {0}", ConstrCode); |
|
69 |
strSQL.Append(" WHERE"); |
|
70 |
strSQL.AppendFormat(" CONSTRUCTIONCODE = {0}", ConstrCode); |
|
76 | 71 |
strSQL.Append(" GROUP BY GROUPCOUNT"); |
77 | 72 |
strSQL.Append(" ORDER BY GROUPCOUNT"); |
78 | 73 |
|
... | ... | |
83 | 78 |
if (InData.Count == 0) continue; |
84 | 79 |
|
85 | 80 |
// 対象データ取得 |
86 |
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])); |
|
87 | 91 |
|
88 |
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])); |
|
89 | 96 |
|
90 |
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])); |
|
91 | 100 |
|
92 |
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])); |
|
93 | 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 |
|
|
94 | 109 |
// ----- 工事詳細台帳更新 |
95 | 110 |
strSQL.Clear(); |
96 | 111 |
strSQL.Append("UPDATE CONSTRUCTIONLEDGER SET"); |
97 | 112 |
strSQL.AppendFormat(" TOTALPAYMENT = {0}", Payment); |
98 |
strSQL.AppendFormat(", GROSSPROFIT = {0}", (Billing - Payment));
|
|
113 |
strSQL.AppendFormat(", GROSSPROFIT = {0}", (Billing - (Payment + Compensation)));
|
|
99 | 114 |
strSQL.AppendFormat(", Allowance = {0}", Allowance); |
100 |
strSQL.AppendFormat(", NETPROFIT = {0}", (Billing - (Payment + Allowance + PExpenses)));
|
|
115 |
strSQL.AppendFormat(", NETPROFIT = {0}", (Billing - ((Payment + Compensation) + Allowance + PExpenses)));
|
|
101 | 116 |
strSQL.AppendFormat(" WHERE CONSTRUCTIONCODE = {0}", ConstrCode); |
102 | 117 |
if (!LedgerExcuteDB.ExecuteNonQuery(strSQL.ToString(), false)) |
103 | 118 |
{ |
... | ... | |
115 | 130 |
} |
116 | 131 |
#endregion |
117 | 132 |
|
118 |
#region 集計用コードセット
|
|
133 |
#region 担当者購入品データ番号より工事詳細台帳のグループ番号を取得する
|
|
119 | 134 |
/// <summary> |
120 |
/// 集計用コードセット
|
|
135 |
/// 担当者購入品データ番号より工事詳細台帳のグループ番号を取得する
|
|
121 | 136 |
/// </summary> |
122 |
private static void SetGroupCodeList(ref List<int> GroupCodeList1, ref List<int> GroupCodeList2, |
|
123 |
ref List<int> GroupCodeList3, ref List<int> GroupCodeList4) |
|
124 |
{ |
|
125 |
try |
|
126 |
{ |
|
127 |
// 対象データ取得 |
|
128 |
// ----- 支払額コードセット |
|
129 |
GroupCodeList1.Add((int)FrmConstructionLedger.DataGroup.Expenses); // 1:経費 |
|
130 |
GroupCodeList1.Add((int)FrmConstructionLedger.DataGroup.ConstructionCosts); // 2:施工費 |
|
131 |
GroupCodeList1.Add((int)FrmConstructionLedger.DataGroup.TransportationCosts); // 3:交通費(通行料・電車代) |
|
132 |
GroupCodeList1.Add((int)FrmConstructionLedger.DataGroup.PurchaseCosts); // 4:購入品 |
|
133 |
GroupCodeList1.Add((int)FrmConstructionLedger.DataGroup.VehicleLeaseFee); // 5:車両リース代 |
|
134 |
GroupCodeList1.Add((int)FrmConstructionLedger.DataGroup.ParkingCosts); // 6:駐車場・資材置き場 |
|
135 |
GroupCodeList1.Add((int)FrmConstructionLedger.DataGroup.RoomChargeCosts); // 7:宿泊費 |
|
136 |
GroupCodeList1.Add((int)FrmConstructionLedger.DataGroup.DisposeCosts); // 8:処分費等 |
|
137 |
|
|
138 |
// ----- 人件費コードセット |
|
139 |
GroupCodeList2.Add((int)FrmConstructionLedger.DataGroup.Instructor); // 9:指導員給料行 |
|
140 |
GroupCodeList2.Add((int)FrmConstructionLedger.DataGroup.Assistant); // 10:副担当者給料行 |
|
141 |
|
|
142 |
// ----- 給与コードセット |
|
143 |
GroupCodeList3.Add((int)FrmConstructionLedger.DataGroup.Payroll); // 11:担当者給料行 |
|
144 |
|
|
145 |
// ----- 請求額コードセット |
|
146 |
GroupCodeList4.Add((int)FrmConstructionLedger.DataGroup.BillingAmount); // 14:請求金額 |
|
147 |
} |
|
148 |
catch (System.Exception ex) |
|
149 |
{ |
|
150 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
151 |
} |
|
152 |
} |
|
153 |
#endregion |
|
154 |
|
|
155 |
#region 配列リストより指定された合計を取得する |
|
156 |
/// <summary> |
|
157 |
/// 配列リストより指定された合計を取得する |
|
158 |
/// </summary> |
|
159 |
private static int CalcGetTotal(ArrayList InData, List<int> GroupCodeList) |
|
160 |
{ |
|
161 |
try |
|
162 |
{ |
|
163 |
int iRetVal = 0; |
|
164 |
|
|
165 |
int GrpNo = -1; |
|
166 |
foreach (int GroupCode in GroupCodeList) |
|
167 |
{ |
|
168 |
foreach (object[] CurRec in InData) |
|
169 |
{ |
|
170 |
GrpNo = CommonMotions.cnvInt(CurRec[0]); |
|
171 |
|
|
172 |
if (GroupCode != GrpNo) continue; |
|
173 |
|
|
174 |
iRetVal += CommonMotions.cnvInt(CurRec[1]); |
|
175 |
} |
|
176 |
} |
|
177 |
|
|
178 |
return iRetVal; |
|
179 |
} |
|
180 |
catch (System.Exception ex) |
|
181 |
{ |
|
182 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
183 |
return 0; |
|
184 |
} |
|
185 |
} |
|
186 |
#endregion |
|
187 |
|
|
188 |
#region 工事詳細台帳のグループ番号を取得する |
|
189 |
/// <summary> |
|
190 |
/// 工事詳細台帳のグループ番号を取得する |
|
191 |
/// </summary> |
|
192 | 137 |
/// <param name="TargetData"></param> |
193 | 138 |
/// <returns></returns> |
194 | 139 |
public static int GetConstructionLedgerGroupNo(int TargetData) |
... | ... | |
199 | 144 |
{ |
200 | 145 |
case (int)CostDataOfPerson.DataNoDef.Transport: |
201 | 146 |
// 交通費(通行料・電車代) |
202 |
GroupNo = (int)FrmConstructionLedger.DataGroup.TransportationCosts;
|
|
147 |
GroupNo = (int)ConstructionLedgerDetail.GroupCountDef.TransportationCosts;
|
|
203 | 148 |
break; |
204 | 149 |
case (int)CostDataOfPerson.DataNoDef.Purchase: |
205 | 150 |
// 購入品 |
206 |
GroupNo = (int)FrmConstructionLedger.DataGroup.PurchaseCosts;
|
|
151 |
GroupNo = (int)ConstructionLedgerDetail.GroupCountDef.PurchaseCosts;
|
|
207 | 152 |
break; |
208 | 153 |
case (int)CostDataOfPerson.DataNoDef.Lease: |
209 | 154 |
// 車両リース代 |
210 |
GroupNo = (int)FrmConstructionLedger.DataGroup.VehicleLeaseFee;
|
|
155 |
GroupNo = (int)ConstructionLedgerDetail.GroupCountDef.VehicleLeaseFee;
|
|
211 | 156 |
break; |
212 | 157 |
case (int)CostDataOfPerson.DataNoDef.StoragePlace: |
213 | 158 |
// 駐車場・資材置き場 |
214 |
GroupNo = (int)FrmConstructionLedger.DataGroup.ParkingCosts;
|
|
159 |
GroupNo = (int)ConstructionLedgerDetail.GroupCountDef.ParkingCosts;
|
|
215 | 160 |
break; |
216 | 161 |
case (int)CostDataOfPerson.DataNoDef.Lodging: |
217 | 162 |
// 宿泊費 |
218 |
GroupNo = (int)FrmConstructionLedger.DataGroup.RoomChargeCosts;
|
|
163 |
GroupNo = (int)ConstructionLedgerDetail.GroupCountDef.RoomChargeCosts;
|
|
219 | 164 |
break; |
220 | 165 |
case (int)CostDataOfPerson.DataNoDef.DisposalCost: |
221 | 166 |
// 処分費 |
222 |
GroupNo = (int)FrmConstructionLedger.DataGroup.DisposeCosts;
|
|
167 |
GroupNo = (int)ConstructionLedgerDetail.GroupCountDef.DisposeCosts;
|
|
223 | 168 |
break; |
224 | 169 |
} |
225 | 170 |
return GroupNo; |
226 | 171 |
} |
227 | 172 |
#endregion |
228 | 173 |
|
229 |
#region 工事詳細台帳より支払金額グリッドの先頭カラム数を取得する |
|
230 |
/// <summary> |
|
231 |
/// 工事詳細台帳より支払金額グリッドの先頭カラム数を取得する |
|
232 |
/// </summary> |
|
233 |
public static int GetLedgerColumnCount() |
|
234 |
{ |
|
235 |
try |
|
236 |
{ |
|
237 |
return (Enum.GetNames(typeof(FrmConstructionLedger.GridColumn)).Length - 1); |
|
238 |
} |
|
239 |
catch (System.Exception ex) |
|
240 |
{ |
|
241 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
242 |
return 0; |
|
243 |
} |
|
244 |
} |
|
245 |
#endregion |
|
246 |
|
|
247 | 174 |
#region 対象年月から工事詳細台帳のグリッドカラム位置を算出する |
248 | 175 |
/// <summary> |
249 | 176 |
/// 対象年月から工事詳細台帳のグリッドカラム位置を算出する |
... | ... | |
264 | 191 |
|
265 | 192 |
object[] objRec = (object[])arList[0]; |
266 | 193 |
DateTime dtADate = CommonMotions.cnvDate(objRec[0]); |
267 |
int nAPoint = CommonMotions.cnvInt(objRec[1]);
|
|
194 |
int nAPoint = CommonMotions.cnvInt(objRec[1]); |
|
268 | 195 |
|
269 | 196 |
int Columncnt = 0; |
270 | 197 |
DateTime dtBDate = new DateTime(TargetMonth.Year, TargetMonth.Month, 1); |
... | ... | |
310 | 237 |
DetailSQL.AppendFormat(" AND OperatingFlg = {0}", (int)ConstructionLedgerDetail.SalOpeKindDef.Oparateing); // 対応中フラグ |
311 | 238 |
DetailSQL.AppendFormat(" AND SALARYFLG != {0}", (int)CommonDefine.SalaryDevision.Noting); // 給与振分区分 |
312 | 239 |
DetailSQL.AppendFormat(" AND GROUPCOUNT IN ({0},{1},{2})", |
313 |
(int)FrmConstructionLedger.DataGroup.Instructor, // 指導員給料
|
|
314 |
(int)FrmConstructionLedger.DataGroup.Assistant, // 副担当者給料
|
|
315 |
(int)FrmConstructionLedger.DataGroup.Payroll); // 担当者給料行
|
|
240 |
(int)ConstructionLedgerDetail.GroupCountDef.Instructor, // 指導員給料
|
|
241 |
(int)ConstructionLedgerDetail.GroupCountDef.Assistant, // 副担当者給料
|
|
242 |
(int)ConstructionLedgerDetail.GroupCountDef.Payroll); // 担当者給料行
|
|
316 | 243 |
|
317 | 244 |
if (!LedgerDeDB.SelectAction(DetailSQL.ToString(), ref DetailList, false) || DetailList.Count == 0) continue; |
318 | 245 |
|
... | ... | |
425 | 352 |
// 支払給与計算 |
426 | 353 |
switch (CurRec.GroupCount) |
427 | 354 |
{ |
428 |
case (int)FrmConstructionLedger.DataGroup.Instructor: // 指導員給料
|
|
429 |
SumSaraly = CommonMotions.cnvRound((double)CommonDefine.InstructorMonthryCost / MonthDayCnt);
|
|
355 |
case (int)ConstructionLedgerDetail.GroupCountDef.Instructor: // 指導員給料
|
|
356 |
SumSaraly = CommonMotions.cnvRound((double)CommonMotions.SystemMasterData.PersonCost1 / MonthDayCnt);
|
|
430 | 357 |
SumSaraly *= (ts.Days + 1); |
431 | 358 |
break; |
432 |
case (int)FrmConstructionLedger.DataGroup.Assistant: // 副担当者給料
|
|
433 |
SumSaraly = CommonMotions.cnvRound((double)CommonDefine.AssistantMonthryCost / MonthDayCnt);
|
|
359 |
case (int)ConstructionLedgerDetail.GroupCountDef.Assistant: // 副担当者給料
|
|
360 |
SumSaraly = CommonMotions.cnvRound((double)CommonMotions.SystemMasterData.PersonCost2 / MonthDayCnt);
|
|
434 | 361 |
SumSaraly *= (ts.Days + 1); |
435 | 362 |
break; |
436 |
case (int)FrmConstructionLedger.DataGroup.Payroll: // 担当者給料行
|
|
363 |
case (int)ConstructionLedgerDetail.GroupCountDef.Payroll: // 担当者給料行
|
|
437 | 364 |
// 範囲給与取得 |
438 | 365 |
SumSaraly = CommonMotions.CalcElapsedSalary(PersonDB, StartDate, CompDate, CurRec.CompanyCode, false); |
439 | 366 |
break; |
... | ... | |
442 | 369 |
// 実行データのキー部年月日は対象月の1日 |
443 | 370 |
DateTime ParaDate = new DateTime(CalcEndtDate.Year, CalcEndtDate.Month, 1); |
444 | 371 |
// 支払いデータ書込み |
445 |
if (!AddOrSetSalary(LedgerExDB
|
|
372 |
if (!SetExecuteSalary(LedgerExDB
|
|
446 | 373 |
, CurRec.ConstructionCode, CurRec.GroupCount, CurRec.LineCount, ColPoint, SumSaraly, ParaDate)) |
447 | 374 |
{ |
448 | 375 |
return false; |
... | ... | |
458 | 385 |
} |
459 | 386 |
#endregion |
460 | 387 |
|
461 |
#region 振分無時の給与書込み
|
|
388 |
#region 台帳へ担当者以外の賃金をセットする
|
|
462 | 389 |
/// <summary> |
463 |
/// 振分無時の給与書込み
|
|
390 |
/// 台帳へ担当者以外の賃金をセットする
|
|
464 | 391 |
/// </summary> |
465 |
private static bool CalcSalaryDevisionNoting(IOConstructionLedgerExcute LedgerExDB, |
|
466 |
ConstructionLedgerDetail CurRec, |
|
467 |
DateTime CalcEndtDate, |
|
468 |
int ColPoint) |
|
392 |
public static bool SetPaymentOther(IOConstructionLedgerExcute LedgerExDB |
|
393 |
, ArrayList TargetList |
|
394 |
, ref List<int> CodeList) |
|
469 | 395 |
{ |
470 | 396 |
try |
471 | 397 |
{ |
472 |
// 実行データのキー部年月日は対象月の1日 |
|
473 |
DateTime ParaDate = new DateTime(CalcEndtDate.Year, CalcEndtDate.Month, 1); |
|
474 |
// 支払いデータ書込み |
|
475 |
if (!AddOrSetSalary(LedgerExDB |
|
476 |
, CurRec.ConstructionCode, CurRec.GroupCount, CurRec.LineCount, ColPoint, 0, ParaDate)) |
|
398 |
int nCodePoint = (int)IOConstructionLedgerExcute.TableColumn.ConstructionCode; |
|
399 |
int nGroupPoint = (int)IOConstructionLedgerDetail.TableColumn.GroupCount; |
|
400 |
int nLinePoint = (int)IOConstructionLedgerDetail.TableColumn.LineCount; |
|
401 |
DateTime ColumnDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); |
|
402 |
|
|
403 |
foreach (object[] ObjRec in TargetList) |
|
477 | 404 |
{ |
478 |
return false; |
|
405 |
int ConstrCode = CommonMotions.cnvInt(ObjRec[nCodePoint]); |
|
406 |
int GroupCount = CommonMotions.cnvInt(ObjRec[nGroupPoint]); |
|
407 |
int LineCount = CommonMotions.cnvInt(ObjRec[nLinePoint]); |
|
408 |
|
|
409 |
int DaySalary = 0; |
|
410 |
if (GroupCount == (int)ConstructionLedgerDetail.GroupCountDef.Instructor) |
|
411 |
{ |
|
412 |
DaySalary = CommonMotions.SystemMasterData.PersonCost1; |
|
413 |
} |
|
414 |
else |
|
415 |
{ |
|
416 |
DaySalary = CommonMotions.SystemMasterData.PersonCost2; |
|
417 |
} |
|
418 |
|
|
419 |
// 対象月より書込みカラム位置を取得する |
|
420 |
int ColumnCount = CalcTargetMonthToColumn(LedgerExDB, false, ConstrCode, ColumnDate); |
|
421 |
// 台帳データへ書き込む |
|
422 |
if (!SetExecuteSalary(LedgerExDB, ConstrCode, GroupCount, LineCount, ColumnCount, DaySalary, ColumnDate)) |
|
423 |
{ |
|
424 |
return false; |
|
425 |
} |
|
426 |
|
|
427 |
// コードリストに無ければ追加する |
|
428 |
if (CodeList.Count > 0 && CodeList.IndexOf(ConstrCode) >= 0) continue; |
|
429 |
CodeList.Add(ConstrCode); |
|
479 | 430 |
} |
480 | 431 |
|
481 | 432 |
return true; |
... | ... | |
488 | 439 |
} |
489 | 440 |
#endregion |
490 | 441 |
|
491 |
#region 日付指定時の給与書込み
|
|
442 |
#region 工事担当者の全日振分給与書込み
|
|
492 | 443 |
/// <summary> |
493 |
/// 日付指定時の給与書込み
|
|
444 |
/// パラメータ順序
|
|
494 | 445 |
/// </summary> |
495 |
private static bool CalcSalaryDevisionDaysInput(IOConstructionLedgerExcute LedgerExDB, |
|
496 |
IOMPersonInCharge PersonDB, |
|
497 |
ConstructionLedger LedgerRec, |
|
498 |
ConstructionLedgerDetail CurRec) |
|
446 |
public enum LedgerOrder |
|
499 | 447 |
{ |
500 |
IOProcessApproval AppDB = new IOProcessApproval(); |
|
448 |
Start = 0, |
|
449 |
Comp, |
|
450 |
} |
|
451 |
public enum DetailOrder |
|
452 |
{ |
|
453 |
ConstructionCode = 0, |
|
454 |
GroupCount, |
|
455 |
LineCount, |
|
456 |
CompanyCode |
|
457 |
} |
|
458 |
/// <summary> |
|
459 |
/// 工事担当者の全日振分給与書込み |
|
460 |
/// </summary> |
|
461 |
public static bool SetPaymentPerson(IOConstructionLedgerExcute LedgerExDB, |
|
462 |
IOMPersonInCharge PersonDB, |
|
463 |
ArrayList TargetList, |
|
464 |
ref List<int> CodeList) |
|
465 |
{ |
|
501 | 466 |
try |
502 | 467 |
{ |
503 |
StringBuilder strSQL = new StringBuilder(); |
|
468 |
DateTime StartDate = DateTime.Now; |
|
469 |
DateTime CompDate = DateTime.Now; |
|
504 | 470 |
|
471 |
int DetailCnt = Enum.GetNames(typeof(IOConstructionLedgerDetail.TableColumn)).Length; |
|
472 |
int nCodePoint = (int)IOConstructionLedgerExcute.TableColumn.ConstructionCode; |
|
473 |
int nGroupPoint = (int)IOConstructionLedgerDetail.TableColumn.GroupCount; |
|
474 |
int nLinePoint = (int)IOConstructionLedgerDetail.TableColumn.LineCount; |
|
475 |
int nPersonPoint = (int)IOConstructionLedgerDetail.TableColumn.CompanyCode; |
|
476 |
DateTime CalcTargetDate = DateTime.Today; |
|
505 | 477 |
|
478 |
// 担当者コード毎の件数を取得する |
|
479 |
List<KeyValuePair<int, int>> TargetCntList = new List<KeyValuePair<int, int>>(); |
|
480 |
PersonGrouping(TargetList, ref TargetCntList); |
|
506 | 481 |
|
507 |
// 月末日より月日数を取得する |
|
508 |
int MonthDayCnt = DateTimeUtil.EndOfMonth(LedgerRec.ConstructionStart).Day; |
|
509 |
int OneDaySalary = 0; |
|
510 |
int nSalaryDays = 0; |
|
511 |
// 支払給与計算 |
|
512 |
switch (CurRec.GroupCount) |
|
482 |
foreach (KeyValuePair<int, int> CurPerson in TargetCntList) |
|
513 | 483 |
{ |
514 |
case (int)FrmConstructionLedger.DataGroup.Instructor: // 指導員給料 |
|
515 |
OneDaySalary = CommonMotions.cnvRound((double)CommonDefine.InstructorMonthryCost / MonthDayCnt); |
|
516 |
break; |
|
517 |
case (int)FrmConstructionLedger.DataGroup.Assistant: // 副担当者給料 |
|
518 |
OneDaySalary = CommonMotions.cnvRound((double)CommonDefine.AssistantMonthryCost / MonthDayCnt); |
|
519 |
OneDaySalary *= CurRec.SalaryDays; |
|
520 |
break; |
|
521 |
case (int)FrmConstructionLedger.DataGroup.Payroll: // 担当者給料行 |
|
522 |
// 給与取得 |
|
523 |
OneDaySalary = CommonMotions.CalcElapsedSalary(PersonDB |
|
524 |
, LedgerRec.ConstructionStart |
|
525 |
, LedgerRec.ConstructionStart |
|
526 |
, CurRec.CompanyCode |
|
527 |
, false); |
|
528 |
break; |
|
529 |
} |
|
484 |
List<object[]> GetList = TargetList.Cast<object[]>().Where(x => CommonMotions.cnvInt(x[nPersonPoint]) == CurPerson.Key).ToList(); |
|
530 | 485 |
|
486 |
// 担当者給料行の範囲給与取得 |
|
487 |
double MonthryCost = 0; |
|
488 |
double YearsCost = 0; |
|
489 |
CommonMotions.GetSalaryValue(PersonDB, CurPerson.Key, ref MonthryCost, ref YearsCost, CalcTargetDate); |
|
490 |
int DaySaraly = CommonMotions.cnvRound(((MonthryCost / CommonDefine.s_WorkTimeOfMonth) * CommonDefine.s_WorkTimeOfDay)); |
|
491 |
int SumSaraly = CommonMotions.cnvRound((double)DaySaraly / CurPerson.Value); |
|
492 |
foreach (object[] ObjRec in GetList) |
|
493 |
{ |
|
494 |
DateTime[] LedgerDate = new DateTime[] { CommonMotions.cnvDate(ObjRec[DetailCnt]) |
|
495 |
, CommonMotions.cnvDate(ObjRec[DetailCnt + 1]) }; |
|
496 |
int[] DetailData = new int[] { CommonMotions.cnvInt(ObjRec[nCodePoint]) |
|
497 |
, CommonMotions.cnvInt(ObjRec[nGroupPoint]) |
|
498 |
, CommonMotions.cnvInt(ObjRec[nLinePoint]) |
|
499 |
, CommonMotions.cnvInt(ObjRec[nPersonPoint]) }; |
|
531 | 500 |
|
532 |
OneDaySalary *= nSalaryDays; |
|
501 |
// 対象月より書込みカラム位置を取得する |
|
502 |
int ColPoint = CalcTargetMonthToColumn(LedgerExDB, false |
|
503 |
, DetailData[(int)DetailOrder.ConstructionCode] |
|
504 |
, CalcTargetDate); |
|
533 | 505 |
|
534 |
// 工事予算が承認された月の位置に書く |
|
535 |
strSQL.Clear(); |
|
536 |
strSQL.Append(AppDB.CreatePrimarykeyString(CurRec.SourceCode, |
|
537 |
3, // 工事予算承認番号(ClsExecuteが無いため) |
|
538 |
(int)CommonDefine.s_Default_OrderNo, |
|
539 |
1)); // 先頭レコード |
|
540 |
strSQL.AppendFormat(" AND ApprovalStatus = {0}", (int)CommonDefine.ApprovalStatus.Approval); |
|
541 |
ProcessApproval AppRec = new ProcessApproval(); |
|
542 |
if (!AppDB.SelectAction(strSQL.ToString(), ref AppRec)) return false; |
|
506 |
// ----- 計算開始日取得 |
|
507 |
// 対象期間の開始が当月の場合は工事開始日を開始にする |
|
508 |
if (LedgerDate[(int)LedgerOrder.Start].Year == CalcTargetDate.Year |
|
509 |
&& LedgerDate[(int)LedgerOrder.Start].Month == CalcTargetDate.Month) |
|
510 |
{ |
|
511 |
StartDate = LedgerDate[(int)LedgerOrder.Start]; |
|
512 |
} |
|
513 |
else |
|
514 |
{ // 違う場合は月初 |
|
515 |
StartDate = new DateTime(CalcTargetDate.Year, CalcTargetDate.Month, 1); |
|
516 |
} |
|
517 |
// ----- 計算終了日取得 |
|
518 |
// 対象期間の終了が当月の場合は当日より前は工事終了日を終了にする |
|
519 |
if (LedgerDate[(int)LedgerOrder.Comp].Year == CalcTargetDate.Year |
|
520 |
&& LedgerDate[(int)LedgerOrder.Comp].Month == CalcTargetDate.Month |
|
521 |
&& LedgerDate[(int)LedgerOrder.Comp].Date < DateTime.Today.Date) |
|
522 |
{ |
|
523 |
CompDate = LedgerDate[(int)LedgerOrder.Comp]; |
|
524 |
} |
|
525 |
else |
|
526 |
{ // 違う場合は対象日 |
|
527 |
CompDate = CalcTargetDate; |
|
528 |
} |
|
543 | 529 |
|
544 |
// 実行データのキー部年月日は開始月の1日 |
|
545 |
DateTime ParaDate = new DateTime(LedgerRec.ConstructionStart.Year |
|
546 |
, LedgerRec.ConstructionStart.Month, 1); |
|
547 |
// 台帳カラム位置 |
|
548 |
int Columncnt = Enum.GetNames(typeof(FrmConstructionLedger.GridColumn)).Length - 1; |
|
530 |
// 実行データのキー部年月日は対象月の1日 |
|
531 |
DateTime ParaDate = new DateTime(CalcTargetDate.Year, CalcTargetDate.Month, 1); |
|
532 |
// 支払いデータ書込み |
|
533 |
if (!AddExecuteSalary(LedgerExDB |
|
534 |
, DetailData[(int)DetailOrder.ConstructionCode] |
|
535 |
, DetailData[(int)DetailOrder.GroupCount] |
|
536 |
, DetailData[(int)DetailOrder.LineCount] |
|
537 |
, ColPoint |
|
538 |
, SumSaraly |
|
539 |
, ParaDate)) |
|
540 |
{ |
|
541 |
return false; |
|
542 |
} |
|
549 | 543 |
|
550 |
// 増減データは承認データを日付として使用する |
|
551 |
if ((CurRec.SourceCode % 10) > 1) |
|
552 |
{ |
|
553 |
DateTime dtStart = LedgerRec.ConstructionStart; |
|
554 |
// 工事詳細台帳実行データよりカラム対象の年月を取得する |
|
555 |
DateTime wrkDate = GetConstructionLedgerStartDate(LedgerExDB, CurRec.ConstructionCode, false); |
|
556 |
if (wrkDate.Date != DateTime.MinValue.Date) dtStart = wrkDate; |
|
557 |
|
|
558 |
// 承認日付より持ってくる |
|
559 |
Columncnt = CalcTargetMonthToColumn(LedgerExDB, false, LedgerRec.ConstructionCode, AppRec.PetitionApprovalDate); |
|
560 |
ParaDate = new DateTime(AppRec.PetitionApprovalDate.Year |
|
561 |
, AppRec.PetitionApprovalDate.Month, 1); |
|
544 |
// コードリストに無ければ追加する |
|
545 |
int ConstrCode = DetailData[(int)DetailOrder.ConstructionCode]; |
|
546 |
if (CodeList.Count > 0 && CodeList.IndexOf(ConstrCode) >= 0) continue; |
|
547 |
CodeList.Add(ConstrCode); |
|
548 |
} |
|
562 | 549 |
} |
563 | 550 |
|
564 |
// 支払いデータ書込み |
|
565 |
if (!AddOrSetSalary(LedgerExDB |
|
566 |
, CurRec.ConstructionCode, CurRec.GroupCount, CurRec.LineCount, Columncnt, OneDaySalary, ParaDate)) |
|
567 |
{ |
|
568 |
return false; |
|
569 |
} |
|
570 |
|
|
571 | 551 |
return true; |
572 | 552 |
} |
573 | 553 |
catch (Exception ex) |
... | ... | |
575 | 555 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
576 | 556 |
return false; |
577 | 557 |
} |
578 |
finally |
|
558 |
} |
|
559 |
#endregion |
|
560 |
|
|
561 |
#region 担当者コード毎の件数を取得する |
|
562 |
/// <summary> |
|
563 |
/// 担当者コード毎の件数を取得する |
|
564 |
/// </summary> |
|
565 |
private static void PersonGrouping(ArrayList TargetList, ref List<KeyValuePair<int, int>> CodeList) |
|
566 |
{ |
|
567 |
try |
|
579 | 568 |
{ |
580 |
AppDB.close(); AppDB = null; |
|
569 |
int nPersonPoint = (int)IOConstructionLedgerDetail.TableColumn.CompanyCode; |
|
570 |
|
|
571 |
int BreakCode = 0; |
|
572 |
int DataCount = 0; |
|
573 |
foreach (object[] ObjRec in TargetList) |
|
574 |
{ |
|
575 |
int GetKey = CommonMotions.cnvInt(ObjRec[nPersonPoint]); |
|
576 |
|
|
577 |
if (BreakCode != 0 && BreakCode != GetKey) |
|
578 |
{ |
|
579 |
CodeList.Add(new KeyValuePair<int, int>(BreakCode, DataCount)); |
|
580 |
DataCount = 0; |
|
581 |
} |
|
582 |
|
|
583 |
BreakCode = GetKey; |
|
584 |
DataCount++; |
|
585 |
} |
|
586 |
|
|
587 |
// 最後のキーをセット |
|
588 |
if (TargetList.Count > 0) |
|
589 |
CodeList.Add(new KeyValuePair<int, int>(BreakCode, DataCount)); |
|
581 | 590 |
} |
591 |
catch (Exception ex) |
|
592 |
{ |
|
593 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
594 |
} |
|
582 | 595 |
} |
583 | 596 |
#endregion |
584 | 597 |
|
585 |
#region 日次処理での日当の加算を判定する
|
|
598 |
#region 詳細台帳に指定金額を設定する
|
|
586 | 599 |
/// <summary> |
587 |
/// 日次処理での日当の加算を判定する
|
|
600 |
/// 詳細台帳に指定金額を設定する
|
|
588 | 601 |
/// </summary> |
589 |
/// <param name="CurRec"></param>
|
|
590 |
/// <returns></returns>
|
|
591 |
private static bool CheckPaymentValue(ConstructionLedgerDetail CurRec)
|
|
602 |
private static bool SetExecuteSalary(IOConstructionLedgerExcute LedgerExDB
|
|
603 |
, int ConstrCode, int GroupCount, int LineCount, int ColumnCount
|
|
604 |
, int DaySalary, DateTime ColumnDate)
|
|
592 | 605 |
{ |
593 |
IOConstructionLedgerExcute ExcuteDB = new IOConstructionLedgerExcute(); |
|
594 | 606 |
try |
595 | 607 |
{ |
596 |
// 支払いデータより合計金額を取得する |
|
597 |
ArrayList arList = new ArrayList(); |
|
598 |
string ExcuteSQL = "SELECT SUM(PAYMENTAMOUNT) FROM CONSTRUCTIONLEDGEREXCUTE"; |
|
599 |
ExcuteSQL += string.Format(" WHERE CONSTRUCTIONCODE = {0}", CurRec.ConstructionCode); |
|
600 |
ExcuteSQL += string.Format(" AND GROUPCOUNT = {0}", CurRec.GroupCount); |
|
601 |
ExcuteSQL += string.Format(" AND LINECOUNT = {0}", CurRec.LineCount); |
|
602 |
if (!ExcuteDB.ExecuteReader(ExcuteSQL, ref arList) || arList.Count == 0) return false; |
|
608 |
// キー作成 |
|
609 |
StringBuilder strSQL = new StringBuilder(); |
|
610 |
strSQL.Append(LedgerExDB.CreatePrimarykeyString(ConstrCode, GroupCount, LineCount, ColumnCount)); |
|
603 | 611 |
|
604 |
object[] wrkobj = (object[])arList[0]; |
|
605 |
int TotalVal = CommonMotions.cnvInt(wrkobj[0]); |
|
612 |
// データ読込み |
|
613 |
List<ConstructionLedgerExcute> LedgerExList = new List<ConstructionLedgerExcute>(); |
|
614 |
if (LedgerExDB.SelectAction(strSQL.ToString(), ref LedgerExList, false) && LedgerExList.Count > 0) |
|
615 |
{ |
|
616 |
// データ更新 |
|
617 |
if (!LedgerExDB.UpdateFeild(ConstrCode, GroupCount, LineCount, ColumnCount |
|
618 |
, (int)IOConstructionLedgerExcute.TableColumn.PaymentAmount |
|
619 |
, (double)DaySalary |
|
620 |
, false)) return false; |
|
621 |
if (LedgerExList[0].TargetMonth.Date != ColumnDate.Date) |
|
622 |
{ |
|
623 |
if (!LedgerExDB.UpdateFeild(ConstrCode, GroupCount, LineCount, ColumnCount |
|
624 |
, (int)IOConstructionLedgerExcute.TableColumn.TargetMonth |
|
625 |
, ColumnDate |
|
626 |
, false)) return false; |
|
627 |
} |
|
606 | 628 |
|
607 |
bool bRet = false;
|
|
608 |
if (TotalVal < CurRec.ExecutionAmount) bRet = true;
|
|
629 |
return true;
|
|
630 |
}
|
|
609 | 631 |
|
610 |
return bRet; |
|
632 |
ConstructionLedgerExcute LedgerExDBRec = new ConstructionLedgerExcute(); |
|
633 |
LedgerExDBRec.ConstructionCode = ConstrCode; // 工事コード |
|
634 |
LedgerExDBRec.GroupCount = GroupCount; // グループ番号 |
|
635 |
LedgerExDBRec.LineCount = LineCount; // 行番号 |
|
636 |
LedgerExDBRec.ColumnCount = ColumnCount; // 列番号 |
|
637 |
LedgerExDBRec.PaymentAmount = DaySalary; // 支払金額 |
|
638 |
LedgerExDBRec.TargetMonth = ColumnDate; // 対象年月 |
|
639 |
|
|
640 |
// データ作成 |
|
641 |
if (!LedgerExDB.InsertAction(LedgerExDBRec, false)) return false; |
|
642 |
|
|
643 |
return true; |
|
611 | 644 |
} |
612 | 645 |
catch (Exception ex) |
613 | 646 |
{ |
... | ... | |
617 | 650 |
} |
618 | 651 |
#endregion |
619 | 652 |
|
620 |
#region 詳細台帳に指定金額を設定するか足しこむ
|
|
653 |
#region 詳細台帳に指定金額を設定する |
|
621 | 654 |
/// <summary> |
622 |
/// 詳細台帳に指定金額を設定するか足しこむ
|
|
655 |
/// 詳細台帳に指定金額を設定する |
|
623 | 656 |
/// </summary> |
624 |
private static bool AddOrSetSalary(IOConstructionLedgerExcute LedgerExDB
|
|
657 |
private static bool AddExecuteSalary(IOConstructionLedgerExcute LedgerExDB
|
|
625 | 658 |
, int ConstrCode, int GroupCount, int LineCount, int ColumnCount |
626 | 659 |
, int DaySalary, DateTime ColumnDate) |
627 | 660 |
{ |
... | ... | |
635 | 668 |
List<ConstructionLedgerExcute> LedgerExList = new List<ConstructionLedgerExcute>(); |
636 | 669 |
if (LedgerExDB.SelectAction(strSQL.ToString(), ref LedgerExList, false) && LedgerExList.Count > 0) |
637 | 670 |
{ |
671 |
strSQL.Clear(); |
|
672 |
strSQL.Append("UPDATE ConstructionLedgerExcute"); |
|
673 |
strSQL.Append(" SET"); |
|
674 |
strSQL.AppendFormat(" PaymentAmount = PaymentAmount + {0}", DaySalary); |
|
675 |
strSQL.Append(", UpdateDate = NOW()"); |
|
676 |
strSQL.Append(LedgerExDB.CreatePrimarykeyString(ConstrCode, GroupCount, LineCount, ColumnCount)); |
|
677 |
|
|
638 | 678 |
// データ更新 |
639 | 679 |
if (!LedgerExDB.UpdateFeild(ConstrCode, GroupCount, LineCount, ColumnCount |
640 | 680 |
, (int)IOConstructionLedgerExcute.TableColumn.PaymentAmount |
641 | 681 |
, (double)DaySalary |
642 | 682 |
, false)) return false; |
643 |
if(LedgerExList[0].TargetMonth.Date != ColumnDate.Date) |
|
683 |
|
|
684 |
if (LedgerExList[0].TargetMonth.Date != ColumnDate.Date) |
|
644 | 685 |
{ |
645 | 686 |
if (!LedgerExDB.UpdateFeild(ConstrCode, GroupCount, LineCount, ColumnCount |
646 | 687 |
, (int)IOConstructionLedgerExcute.TableColumn.TargetMonth |
... | ... | |
672 | 713 |
} |
673 | 714 |
#endregion |
674 | 715 |
|
716 |
#region 工事詳細台帳より新しい行作成のため新規の明細番号を取得する |
|
717 |
/// <summary> |
|
718 |
/// 工事詳細台帳より新しい行作成のため新規の明細番号を取得する |
|
719 |
/// </summary> |
|
720 |
public static int GetNewDetailcout(IOConstructionLedgerDetail DetailDB, bool bConnect, int ConstrCode) |
|
721 |
{ |
|
722 |
try |
|
723 |
{ |
|
724 |
StringBuilder strSQL = new StringBuilder(); |
|
725 |
strSQL.Append("Select ConstructionCode, (MAX(DetailCount) + 1) As NewNo From constructionledgerdetail"); |
|
726 |
strSQL.AppendFormat(" Where ConstructionCode = {0}", ConstrCode); |
|
727 |
strSQL.AppendFormat(" And GroupCount = {0}", (int)ConstructionLedgerDetail.GroupCountDef.ConstructionCosts); |
|
728 |
|
|
729 |
ArrayList arList = new ArrayList(); |
|
730 |
if (!DetailDB.ExecuteReader(strSQL.ToString(), ref arList, bConnect)) return 0; |
|
731 |
if (arList.Count < 1) return 0; |
|
732 |
|
|
733 |
object[] objRec = (object[])arList[0]; |
|
734 |
|
|
735 |
return CommonMotions.cnvInt(objRec[1]); |
|
736 |
} |
|
737 |
catch (Exception ex) |
|
738 |
{ |
|
739 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
740 |
return 0; |
|
741 |
} |
|
742 |
} |
|
743 |
#endregion |
|
744 |
|
|
675 | 745 |
#region 工事詳細台帳実行データより最小カラムの対象年月日を取得する |
676 | 746 |
/// <summary> |
677 | 747 |
/// 工事詳細台帳実行データより最小カラムの対象年月日を取得する |
... | ... | |
682 | 752 |
{ |
683 | 753 |
// 工事詳細台帳実行データよりカラム対象の年月を取得する |
684 | 754 |
StringBuilder strCol = new StringBuilder(); |
685 |
strCol.Append("SELECT MIN(ColumnCount), TargetMonth From constructionledgerexcute"); |
|
686 |
strCol.AppendFormat(" Where ConstructionCode = {0}", ConstrCode); |
|
755 |
strCol.Append("Select"); |
|
756 |
strCol.Append(" Distinct A.ColumnCount"); |
|
757 |
strCol.Append(" , A.TargetMonth"); |
|
758 |
strCol.Append(" From constructionledgerexcute As A"); |
|
759 |
strCol.Append(" Where"); |
|
760 |
strCol.AppendFormat(" A.ConstructionCode = {0}", ConstrCode); |
|
761 |
strCol.Append(" And ColumnCount ="); |
|
762 |
strCol.Append(" (SELECT"); |
|
763 |
strCol.Append(" MIN(ColumnCount)"); |
|
764 |
strCol.Append(" From constructionledgerexcute As B"); |
|
765 |
strCol.Append(" Where"); |
|
766 |
strCol.AppendFormat(" B.ConstructionCode = {0})", ConstrCode); |
|
687 | 767 |
ArrayList arrCol = new ArrayList(); |
688 | 768 |
if (!LedgerExcuteDB.ExecuteReader(strCol.ToString(), ref arrCol, bTableConnect)) return DateTime.MinValue; |
689 | 769 |
|
trunk/src/DataCheckExcute/DataCheckExcute/Common/Process/ClsCostCulculation.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Threading.Tasks; |
|
6 |
|
|
7 |
using log4net; |
|
8 |
using log4net.Appender; |
|
9 |
using log4net.Repository.Hierarchy; |
|
10 |
|
|
11 |
using ProcessManagement.DB.Core; |
|
12 |
using ProcessManagement.DataModel; |
|
13 |
using ProcessManagement.DB.IOAccess; |
|
14 |
|
|
15 |
namespace ProcessManagement.Common |
|
16 |
{ |
|
17 |
/// <summary> |
|
18 |
/// 共通費計算クラス 2016/03/02 |
|
19 |
/// </summary> |
|
20 |
public static class ClsCostCulculation |
|
21 |
{ |
|
22 |
#region 定義部 |
|
23 |
/// <summary> |
|
24 |
/// log4netログを使用する |
|
25 |
/// </summary> |
|
26 |
private static ILog logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
|
27 |
#endregion |
|
28 |
|
|
29 |
#region 定数 |
|
30 |
|
|
31 |
#region ----- 共通仮設率計算係数テーブル |
|
32 |
/// <summary> |
|
33 |
/// 共通仮設率計算係数テーブル |
|
34 |
/// 0:区分設定金額 |
|
35 |
/// 1:区分設定金額以下係数 下限 |
|
36 |
/// 2:区分設定金額以下係数 上限 |
|
37 |
/// 3:区分設定金額超係数 下限 |
|
38 |
/// 4:区分設定金額超係数 下限指数 |
|
39 |
/// 5:区分設定金額超係数 上限 |
|
40 |
/// 6:区分設定金額超係数 上限指数 |
|
41 |
/// 7:共通仮設費率係数 |
|
42 |
/// 8:工事費指数 |
|
43 |
/// 9:工期指数 |
|
44 |
/// </summary> |
|
45 |
private static double[,] s_CommonTempList = new double[6, 10] { |
|
46 |
{ 10000000.0, 3.25, 4.33, 4.34, -0.0313, 5.78, -0.0313, 7.56, -0.1105, 0.2389 }, // 新営建築工事 |
|
47 |
{ 5000000.0, 3.59, 6.07, 6.94, -0.0774, 11.74, -0.0774, 18.03, -0.2027, 0.4017 }, // 改修建築工事 |
|
48 |
{ 5000000.0, 3.90, 7.19, 9.08, -0.0992, 16.73, -0.0992, 22.89, -0.2462, 0.4100 }, // 新営電気設備工事 |
|
49 |
{ 3000000.0, 1.91, 5.21, 3.10, -0.0608, 8.47, -0.0608, 10.15, -0.2462, 0.6929 }, // 改修電気設備工事 |
|
50 |
{ 5000000.0, 4.86, 5.51, 10.94, -0.0952, 12.40, -0.0952, 12.15, -0.1186, 0.0882 }, // 新営機械設備工事 |
|
51 |
{ 3000000.0, 1.73, 4.96, 2.44, -0.0433, 7.02, -0.0433, 12.21, -0.2596, 0.6874 }, // 改修機械設備工事 |
|
52 |
}; |
|
53 |
#endregion |
|
54 |
|
|
55 |
#region 共通仮設率計算係数テーブル・現場管理率計算係数テーブル(その他工事) |
|
56 |
/// <summary> |
|
57 |
/// 共通仮設率計算係数テーブル・現場管理率計算係数テーブル(その他工事) |
|
58 |
/// </summary> |
|
59 |
public enum CommonTempListDef |
|
60 |
{ |
|
61 |
/// <summary> |
|
62 |
/// 0:区分設定金額 |
|
63 |
/// </summary> |
|
64 |
SetAmount = 0, |
|
65 |
/// <summary> |
|
66 |
/// 1:区分設定金額以下係数 下限 |
|
67 |
/// </summary> |
|
68 |
CoefficientLow, |
|
69 |
/// <summary> |
|
70 |
/// 2:区分設定金額以下係数 上限 |
|
71 |
/// </summary> |
|
72 |
CoefficientHigh, |
|
73 |
/// <summary> |
|
74 |
/// 3:区分設定金額超係数 下限 |
|
75 |
/// </summary> |
|
76 |
CoefficientOverLow, |
|
77 |
/// <summary> |
|
78 |
/// 4:区分設定金額超係数 下限累乗値 |
|
79 |
/// </summary> |
|
80 |
CoefficientOverLowIndex, |
|
81 |
/// <summary> |
|
82 |
/// 5:区分設定金額超係数 上限 |
|
83 |
/// </summary> |
|
84 |
CoefficientOverHigh, |
|
85 |
/// <summary> |
|
86 |
/// 6:区分設定金額超係数 上限累乗値 |
|
87 |
/// </summary> |
|
88 |
CoefficientOverHighIndex, |
|
89 |
/// <summary> |
|
90 |
/// 7:共通仮設費率係数 |
|
91 |
/// </summary> |
|
92 |
CommonCoefficient, |
|
93 |
/// <summary> |
|
94 |
/// 8:工事費係数 |
|
95 |
/// </summary> |
|
96 |
ConstrCostsIndex, |
|
97 |
/// <summary> |
|
98 |
/// 9:工期累乗値 |
|
99 |
/// </summary> |
|
100 |
ConstrTimesIndex, |
|
101 |
} |
|
102 |
#endregion |
|
103 |
|
|
104 |
#region ----- 共通仮設率計算係数テーブル(昇降機設備工事) |
|
105 |
/// <summary> |
|
106 |
/// 共通仮設率計算係数テーブル(昇降機設備工事) |
|
107 |
/// 0:区分設定金額以下 |
|
108 |
/// 1:区分設定金額以下係数 |
|
109 |
/// 2:区分設定金額以下 |
|
110 |
/// 3:区分設定金額以下 共通仮設費率係数 |
|
111 |
/// 4:工事費累乗値 |
|
112 |
/// 5:区分設定金額超係数 |
|
113 |
/// </summary> |
|
114 |
private static double[] s_CommonTempList2 = new double[6] { 10000000.0, 3.08, 500000000.0, 7.89, -0.1021, 2.07 }; |
|
115 |
#endregion |
|
116 |
|
|
117 |
#region ----- 現場管理率計算係数テーブル |
|
118 |
/// <summary> |
|
119 |
/// 現場管理率計算係数テーブル |
|
120 |
/// 0:区分設定金額 |
|
121 |
/// 1:区分設定金額以下係数 下限 |
|
122 |
/// 2:区分設定金額以下係数 上限 |
|
123 |
/// 3:区分設定金額超係数 下限 |
|
124 |
/// 4:区分設定金額超係数 下限累乗値 |
|
125 |
/// 5:区分設定金額超係数 上限 |
|
126 |
/// 6:区分設定金額超係数 上限累乗値 |
|
127 |
/// 7:現場管理費率係数 |
|
128 |
/// 8:工事費指数 |
|
129 |
/// 9:工期累乗値 |
|
130 |
/// </summary> |
|
131 |
private static double[,] s_FieldManageList = new double[6, 10] { |
|
132 |
{ 10000000.0, 10.01, 20.13, 37.76, -0.1442, 75.97, -0.1442, 151.08, -0.3396, 0.5860 }, // 新営建築工事 |
|
133 |
{ 5000000.0, 12.70, 26.86, 87.29, -0.2263, 184.58, -0.2263, 356.20, -0.4085, 0.5766 }, // 改修建築工事 |
|
134 |
{ 5000000.0, 22.91, 38.60, 156.07, -0.2253, 263.03, -0.2253, 351.48, -0.3528, 0.3524 }, // 新営電気設備工事 |
|
135 |
{ 3000000.0, 17.67, 50.37, 186.18, -0.2941, 530.68, -0.2941, 658.42, -0.4896, 0.7247 }, // 改修電気設備工事 |
|
136 |
{ 5000000.0, 17.14, 31.23, 90.67, -0.1956, 165.22, -0.1956, 152.72, -0.3085, 0.4222 }, // 新営機械設備工事 |
|
137 |
{ 3000000.0, 15.25, 42.07, 169.65, -0.3009, 467.95, -0.3009, 825.85, -0.5122, 0.6648 }, // 改修機械設備工事 |
|
138 |
}; |
|
139 |
#endregion |
|
140 |
|
|
141 |
#region ----- 現場管理率計算係数テーブル(昇降機設備工事) |
|
142 |
/// <summary> |
|
143 |
/// 現場管理率計算係数テーブル(昇降機設備工事) |
|
144 |
/// 0:区分設定金額以下 |
|
145 |
/// 1:区分設定金額以下係数 |
|
146 |
/// 2:区分設定金額以下 |
|
147 |
/// 3:区分設定金額以下 現場管理費率係数 |
|
148 |
/// 4:工事費累乗値 |
|
149 |
/// 5:区分設定金額超係数 |
|
150 |
/// </summary> |
|
151 |
private static double[] s_FieldManageList2 = new double[6] { 10000000.0, 3.98, 500000000.0, 15.10, -0.1449, 2.26 }; |
|
152 |
#endregion |
|
153 |
|
|
154 |
#region ----- 一般管理率計算係数テーブル |
|
155 |
/// <summary> |
|
156 |
/// 一般管理率計算係数テーブル |
|
157 |
/// 0:工事原価(下限) |
|
158 |
/// 1:一般管理費等率 |
|
159 |
/// 2:工事原価(上限) |
|
160 |
/// 3:一般管理費等率計算時係数1 |
|
161 |
/// 4:一般管理費等率計算時係数2 |
|
162 |
/// 5:工事原価上限超時一般管理費等率 |
|
163 |
/// </summary> |
|
164 |
private static double[,] s_GeneralManageList = new double[3, 6] { |
|
165 |
{ 5000000.0, 17.24, 3000000000.0, 28.978, 3.173, 8.43 }, // 建築工事 |
|
166 |
{ 3000000.0, 17.49, 2000000000.0, 29.102, 3.340, 8.06 }, // 電気設備工事 |
|
167 |
{ 3000000.0, 16.68, 2000000000.0, 27.283, 3.049, 8.07 } // 機械設備・昇降設備工事 |
|
168 |
}; |
|
169 |
#endregion |
|
170 |
|
|
171 |
#region ----- 入力単位(千円) |
|
172 |
/// <summary> |
|
173 |
/// 入力単位(千円) |
|
174 |
/// </summary> |
|
175 |
private static double s_InputUnit = 1000.0; |
|
176 |
#endregion |
|
177 |
|
|
178 |
#endregion |
|
179 |
|
|
180 |
#region プロパティ |
|
181 |
|
|
182 |
#region 共通仮設率計算係数テーブル |
|
183 |
/// <summary> |
|
184 |
/// 共通仮設率計算係数テーブル |
|
185 |
/// </summary> |
|
186 |
public static double[,] CommonTempList |
|
187 |
{ |
|
188 |
get { return s_CommonTempList; } |
|
189 |
set { s_CommonTempList = value; } |
|
190 |
} |
|
191 |
#endregion |
|
192 |
|
|
193 |
#region 共通仮設率計算係数テーブル |
|
194 |
/// <summary> |
|
195 |
/// 共通仮設率計算係数テーブル(昇降機設備工事) |
|
196 |
/// </summary> |
|
197 |
public static double[] CommonTempList2 |
|
198 |
{ |
|
199 |
get { return s_CommonTempList2; } |
|
200 |
set { s_CommonTempList2 = value; } |
|
201 |
} |
|
202 |
#endregion |
|
203 |
|
|
204 |
#region 現場管理率計算係数テーブル |
|
205 |
/// <summary> |
|
206 |
/// 現場管理率計算係数テーブル |
|
207 |
/// </summary> |
|
208 |
public static double[,] FieldManageList |
|
209 |
{ |
|
210 |
get { return s_FieldManageList; } |
|
211 |
set { s_FieldManageList = value; } |
|
212 |
} |
|
213 |
#endregion |
|
214 |
|
|
215 |
#region 現場管理率計算係数テーブル(昇降機設備工事) |
|
216 |
/// <summary> |
|
217 |
/// 現場管理率計算係数テーブル(昇降機設備工事) |
|
218 |
/// </summary> |
|
219 |
public static double[] FieldManageList2 |
|
220 |
{ |
|
221 |
get { return s_FieldManageList2; } |
|
222 |
set { s_FieldManageList2 = value; } |
|
223 |
} |
|
224 |
#endregion |
|
225 |
|
|
226 |
#region 一般管理率計算係数テーブル |
|
227 |
/// <summary> |
|
228 |
/// 一般管理率計算係数テーブル |
|
229 |
/// </summary> |
|
230 |
public static double[,] GeneralManageList |
|
231 |
{ |
|
232 |
get { return s_GeneralManageList; } |
|
233 |
set { s_GeneralManageList = value; } |
|
234 |
} |
|
235 |
#endregion |
|
236 |
|
|
237 |
#endregion |
|
238 |
|
|
239 |
#region DBより内部へデータを取り込む |
|
240 |
/// <summary> |
|
241 |
/// DBより内部へデータを取り込む |
|
242 |
/// </summary> |
|
243 |
public static bool DBToArrayData() |
|
244 |
{ |
|
245 |
IOCalcCoefficient CalcDB = new IOCalcCoefficient(); |
|
246 |
try |
|
247 |
{ |
|
248 |
// 共通仮設費取得 |
|
249 |
if (!ToArrayCommonTempList1(CalcDB)) return false; |
|
250 |
if (!ToArrayCommonTempList2(CalcDB)) return false; |
|
251 |
|
|
252 |
// 現場管理費取得 |
|
253 |
if (!ToArrayFieldManageList1(CalcDB)) return false; |
|
254 |
if (!ToArrayFieldManageList2(CalcDB)) return false; |
|
255 |
|
|
256 |
// 一般管理費取得 |
|
257 |
if (!ToArrayGeneralManageList(CalcDB)) return false; |
|
258 |
|
|
259 |
return true; |
|
260 |
} |
|
261 |
catch (System.Exception ex) |
|
262 |
{ |
|
263 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
264 |
return false; |
|
265 |
} |
|
266 |
finally |
|
267 |
{ |
|
268 |
CalcDB.close();CalcDB = null; |
|
269 |
} |
|
270 |
} |
|
271 |
#endregion |
|
272 |
|
|
273 |
#region 共通仮設費取得 |
|
274 |
/// <summary> |
|
275 |
/// 共通仮設費取得 |
|
276 |
/// </summary> |
|
277 |
private static bool ToArrayCommonTempList1(IOCalcCoefficient CalcDB) |
|
278 |
{ |
|
279 |
try |
|
280 |
{ |
|
281 |
StringBuilder strSQL = new StringBuilder(); |
|
282 |
// 共通仮設費取得 |
|
283 |
strSQL.Append(CalcDB.CreatePrimarykeyString((int)CalcCoefficient.TypeCodeDef.CommonTemp)); |
|
284 |
strSQL.Append(" Order By SeqNo Asc"); |
|
285 |
List<CalcCoefficient> calcs = new List<CalcCoefficient>(); |
|
286 |
if (!CalcDB.SelectAction(strSQL.ToString(), ref calcs)) return false; |
|
287 |
if (calcs.Count < 1) return true; |
|
288 |
|
|
289 |
for (int iy = 0; iy < s_CommonTempList.GetLength(0); iy++) |
|
290 |
{ |
|
291 |
CalcCoefficient CurRec = calcs[iy]; |
|
292 |
s_CommonTempList[iy, (int)ClsCostCulculation.CommonTempListDef.SetAmount] = (double)CurRec.CalcCoefficient01; |
|
293 |
s_CommonTempList[iy, (int)CommonTempListDef.CoefficientLow] = (double)CurRec.CalcCoefficient02; |
|
294 |
s_CommonTempList[iy, (int)CommonTempListDef.CoefficientHigh] = (double)CurRec.CalcCoefficient03; |
|
295 |
s_CommonTempList[iy, (int)CommonTempListDef.CoefficientOverLow] = (double)CurRec.CalcCoefficient04; |
|
296 |
s_CommonTempList[iy, (int)CommonTempListDef.CoefficientOverLowIndex] = (double)CurRec.CalcCoefficient05; |
|
297 |
s_CommonTempList[iy, (int)CommonTempListDef.CoefficientOverHigh] = (double)CurRec.CalcCoefficient06; |
|
298 |
s_CommonTempList[iy, (int)CommonTempListDef.CoefficientOverHighIndex] = (double)CurRec.CalcCoefficient07; |
|
299 |
s_CommonTempList[iy, (int)CommonTempListDef.CommonCoefficient] = (double)CurRec.CalcCoefficient08; |
|
300 |
s_CommonTempList[iy, (int)CommonTempListDef.ConstrCostsIndex] = (double)CurRec.CalcCoefficient09; |
|
301 |
s_CommonTempList[iy, (int)CommonTempListDef.ConstrTimesIndex] = (double)CurRec.CalcCoefficient10; |
|
302 |
} |
|
303 |
|
|
304 |
return true; |
|
305 |
} |
|
306 |
catch (System.Exception ex) |
|
307 |
{ |
|
308 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
309 |
return false; |
|
310 |
} |
|
311 |
} |
|
312 |
private static bool ToArrayCommonTempList2(IOCalcCoefficient CalcDB) |
|
313 |
{ |
|
314 |
try |
|
315 |
{ |
|
316 |
StringBuilder strSQL = new StringBuilder(); |
|
317 |
// 共通仮設費取得 |
|
318 |
strSQL.Append(CalcDB.CreatePrimarykeyString((int)CalcCoefficient.TypeCodeDef.CommonTemp2)); |
|
319 |
strSQL.Append(" Order By SeqNo Asc"); |
|
320 |
List<CalcCoefficient> calcs = new List<CalcCoefficient>(); |
|
321 |
if (!CalcDB.SelectAction(strSQL.ToString(), ref calcs)) return false; |
|
322 |
if (calcs.Count < 1) return true; |
|
323 |
|
|
324 |
CalcCoefficient CurRec = calcs[0]; |
|
325 |
s_CommonTempList2[0] = (double)CurRec.CalcCoefficient01; |
|
326 |
s_CommonTempList2[1] = (double)CurRec.CalcCoefficient02; |
|
327 |
s_CommonTempList2[2] = (double)CurRec.CalcCoefficient03; |
|
328 |
s_CommonTempList2[3] = (double)CurRec.CalcCoefficient04; |
|
329 |
s_CommonTempList2[4] = (double)CurRec.CalcCoefficient05; |
|
330 |
s_CommonTempList2[5] = (double)CurRec.CalcCoefficient06; |
|
331 |
|
|
332 |
return true; |
|
333 |
} |
|
334 |
catch (System.Exception ex) |
|
335 |
{ |
|
336 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
337 |
return false; |
|
338 |
} |
|
339 |
} |
|
340 |
#endregion |
|
341 |
|
|
342 |
#region 現場管理費取得 |
|
343 |
/// <summary> |
|
344 |
/// 現場管理費取得 |
|
345 |
/// </summary> |
|
346 |
private static bool ToArrayFieldManageList1(IOCalcCoefficient CalcDB) |
|
347 |
{ |
|
348 |
try |
|
349 |
{ |
|
350 |
StringBuilder strSQL = new StringBuilder(); |
|
351 |
// 現場管理費取得 |
|
352 |
strSQL.Append(CalcDB.CreatePrimarykeyString((int)CalcCoefficient.TypeCodeDef.FieldManage)); |
|
353 |
strSQL.Append(" Order By SeqNo Asc"); |
|
354 |
List<CalcCoefficient> calcs = new List<CalcCoefficient>(); |
|
355 |
if (!CalcDB.SelectAction(strSQL.ToString(), ref calcs)) return false; |
|
356 |
if (calcs.Count < 1) return true; |
|
357 |
|
|
358 |
for (int iy = 0; iy < s_FieldManageList.GetLength(0); iy++) |
|
359 |
{ |
|
360 |
CalcCoefficient CurRec = calcs[iy]; |
|
361 |
s_FieldManageList[iy, (int)CommonTempListDef.SetAmount] = (double)CurRec.CalcCoefficient01; |
|
362 |
s_FieldManageList[iy, (int)CommonTempListDef.CoefficientLow] = (double)CurRec.CalcCoefficient02; |
|
363 |
s_FieldManageList[iy, (int)CommonTempListDef.CoefficientHigh] = (double)CurRec.CalcCoefficient03; |
|
364 |
s_FieldManageList[iy, (int)CommonTempListDef.CoefficientOverLow] = (double)CurRec.CalcCoefficient04; |
|
365 |
s_FieldManageList[iy, (int)CommonTempListDef.CoefficientOverLowIndex] = (double)CurRec.CalcCoefficient05; |
|
366 |
s_FieldManageList[iy, (int)CommonTempListDef.CoefficientOverHigh] = (double)CurRec.CalcCoefficient06; |
|
367 |
s_FieldManageList[iy, (int)CommonTempListDef.CoefficientOverHighIndex] = (double)CurRec.CalcCoefficient07; |
|
368 |
s_FieldManageList[iy, (int)CommonTempListDef.CommonCoefficient] = (double)CurRec.CalcCoefficient08; |
|
369 |
s_FieldManageList[iy, (int)CommonTempListDef.ConstrCostsIndex] = (double)CurRec.CalcCoefficient09; |
|
370 |
s_FieldManageList[iy, (int)CommonTempListDef.ConstrTimesIndex] = (double)CurRec.CalcCoefficient10; |
|
371 |
} |
|
372 |
|
|
373 |
return true; |
|
374 |
} |
|
375 |
catch (System.Exception ex) |
|
376 |
{ |
|
377 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
378 |
return false; |
|
379 |
} |
|
380 |
} |
|
381 |
private static bool ToArrayFieldManageList2(IOCalcCoefficient CalcDB) |
|
382 |
{ |
|
383 |
try |
|
384 |
{ |
|
385 |
StringBuilder strSQL = new StringBuilder(); |
|
386 |
// 現場管理費取得 |
|
387 |
strSQL.Append(CalcDB.CreatePrimarykeyString((int)CalcCoefficient.TypeCodeDef.FieldManage2)); |
|
388 |
strSQL.Append(" Order By SeqNo Asc"); |
|
389 |
List<CalcCoefficient> calcs = new List<CalcCoefficient>(); |
|
390 |
if (!CalcDB.SelectAction(strSQL.ToString(), ref calcs)) return false; |
|
391 |
if (calcs.Count < 1) return true; |
|
392 |
|
|
393 |
CalcCoefficient CurRec = calcs[0]; |
|
394 |
s_FieldManageList2[0] = (double)CurRec.CalcCoefficient01; |
|
395 |
s_FieldManageList2[1] = (double)CurRec.CalcCoefficient02; |
|
396 |
s_FieldManageList2[2] = (double)CurRec.CalcCoefficient03; |
|
397 |
s_FieldManageList2[3] = (double)CurRec.CalcCoefficient04; |
|
398 |
s_FieldManageList2[4] = (double)CurRec.CalcCoefficient05; |
|
399 |
s_FieldManageList2[5] = (double)CurRec.CalcCoefficient06; |
|
400 |
|
|
401 |
return true; |
|
402 |
} |
|
403 |
catch (System.Exception ex) |
|
404 |
{ |
|
405 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
406 |
return false; |
|
407 |
} |
|
408 |
} |
|
409 |
#endregion |
|
410 |
|
|
411 |
#region 一般管理費取得 |
|
412 |
/// <summary> |
|
413 |
/// 一般管理費取得 |
|
414 |
/// </summary> |
|
415 |
private static bool ToArrayGeneralManageList(IOCalcCoefficient CalcDB) |
|
416 |
{ |
|
417 |
try |
|
418 |
{ |
|
419 |
StringBuilder strSQL = new StringBuilder(); |
|
420 |
// 一般管理費取得 |
|
421 |
strSQL.Append(CalcDB.CreatePrimarykeyString((int)CalcCoefficient.TypeCodeDef.GeneralManage)); |
|
422 |
strSQL.Append(" Order By SeqNo Asc"); |
|
423 |
List<CalcCoefficient> calcs = new List<CalcCoefficient>(); |
|
424 |
if (!CalcDB.SelectAction(strSQL.ToString(), ref calcs)) return false; |
|
425 |
if (calcs.Count < 1) return true; |
|
426 |
|
|
427 |
for (int iy = 0; iy < s_GeneralManageList.GetLength(0); iy++) |
|
428 |
{ |
|
429 |
CalcCoefficient CurRec = calcs[iy]; |
|
430 |
s_GeneralManageList[iy, 0] = (double)CurRec.CalcCoefficient01; |
|
431 |
s_GeneralManageList[iy, 1] = (double)CurRec.CalcCoefficient02; |
|
432 |
s_GeneralManageList[iy, 2] = (double)CurRec.CalcCoefficient03; |
|
433 |
s_GeneralManageList[iy, 3] = (double)CurRec.CalcCoefficient04; |
|
434 |
s_GeneralManageList[iy, 4] = (double)CurRec.CalcCoefficient05; |
|
435 |
s_GeneralManageList[iy, 5] = (double)CurRec.CalcCoefficient06; |
|
436 |
} |
|
437 |
|
|
438 |
return true; |
|
439 |
} |
|
440 |
catch (System.Exception ex) |
|
441 |
{ |
|
442 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
443 |
return false; |
|
444 |
} |
|
445 |
} |
|
446 |
#endregion |
|
447 |
|
|
448 |
#region 内部をDBへデータを書き込む |
|
449 |
/// <summary> |
|
450 |
/// 内部をDBへデータを書き込む |
|
451 |
/// </summary> |
|
452 |
public static bool ArrayToDBData() |
|
453 |
{ |
|
454 |
IOCalcCoefficient CalcDB = new IOCalcCoefficient(); |
|
455 |
try |
|
456 |
{ |
|
457 |
CalcDB.connect(); CalcDB.beginTran(); |
|
458 |
|
|
459 |
// 共通仮設費書込み |
|
460 |
if (!ToDBCommonTempList1(CalcDB)) |
|
461 |
{ |
|
462 |
CalcDB.rollback(); |
|
463 |
return false; |
|
464 |
} |
|
465 |
if (!ToDBCommonTempList2(CalcDB)) |
|
466 |
{ |
|
467 |
CalcDB.rollback(); |
|
468 |
return false; |
|
469 |
} |
|
470 |
|
|
471 |
// 現場管理費書込み |
|
472 |
if (!ToDBFieldManageList1(CalcDB)) |
|
473 |
{ |
|
474 |
CalcDB.rollback(); |
|
475 |
return false; |
|
476 |
} |
|
477 |
if (!ToDBFieldManageList2(CalcDB)) |
|
478 |
{ |
|
479 |
CalcDB.rollback(); |
|
480 |
return false; |
|
481 |
} |
|
482 |
|
|
483 |
// 一般管理費書込み |
|
484 |
if(!ToDBGeneralManageList(CalcDB)) |
|
485 |
{ |
|
486 |
CalcDB.rollback(); |
|
487 |
return false; |
|
488 |
} |
|
489 |
|
|
490 |
CalcDB.commit(); |
|
491 |
|
|
492 |
return true; |
|
493 |
} |
|
494 |
catch (System.Exception ex) |
|
495 |
{ |
|
496 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
497 |
return false; |
|
498 |
} |
|
499 |
finally |
|
500 |
{ |
|
501 |
CalcDB.close(); CalcDB = null; |
|
502 |
} |
|
503 |
} |
|
504 |
#endregion |
|
505 |
|
|
506 |
#region 共通仮設費書込み |
|
507 |
/// <summary> |
|
508 |
/// 共通仮設費書込み |
|
509 |
/// </summary> |
|
510 |
private static bool ToDBCommonTempList1(IOCalcCoefficient CalcDB) |
|
511 |
{ |
|
512 |
try |
|
513 |
{ |
|
514 |
StringBuilder strSQL = new StringBuilder(); |
|
515 |
// 共通仮設費書込み |
|
516 |
strSQL.Append(CalcDB.CreatePrimarykeyString((int)CalcCoefficient.TypeCodeDef.CommonTemp)); |
|
517 |
CalcDB.DeleteAction(strSQL.ToString(), false); |
|
518 |
|
|
519 |
List<CalcCoefficient> calcs = new List<CalcCoefficient>(); |
|
520 |
for (int iy = 0; iy < s_CommonTempList.GetLength(0); iy++) |
|
521 |
{ |
|
522 |
CalcCoefficient CurRec = new CalcCoefficient(); |
|
523 |
CurRec.TypeCode = (int)CalcCoefficient.TypeCodeDef.CommonTemp; |
|
524 |
CurRec.SeqNo = (iy + 1); |
|
525 |
CurRec.CalcCoefficient01 = (decimal)s_CommonTempList[iy, (int)ClsCostCulculation.CommonTempListDef.SetAmount]; |
|
526 |
CurRec.CalcCoefficient02 = (decimal)s_CommonTempList[iy, (int)CommonTempListDef.CoefficientLow]; |
|
527 |
CurRec.CalcCoefficient03 = (decimal)s_CommonTempList[iy, (int)CommonTempListDef.CoefficientHigh]; |
|
528 |
CurRec.CalcCoefficient04 = (decimal)s_CommonTempList[iy, (int)CommonTempListDef.CoefficientOverLow]; |
|
529 |
CurRec.CalcCoefficient05 = (decimal)s_CommonTempList[iy, (int)CommonTempListDef.CoefficientOverLowIndex]; |
|
530 |
CurRec.CalcCoefficient06 = (decimal)s_CommonTempList[iy, (int)CommonTempListDef.CoefficientOverHigh]; |
|
531 |
CurRec.CalcCoefficient07 = (decimal)s_CommonTempList[iy, (int)CommonTempListDef.CoefficientOverHighIndex]; |
|
532 |
CurRec.CalcCoefficient08 = (decimal)s_CommonTempList[iy, (int)CommonTempListDef.CommonCoefficient]; |
|
533 |
CurRec.CalcCoefficient09 = (decimal)s_CommonTempList[iy, (int)CommonTempListDef.ConstrCostsIndex]; |
|
534 |
CurRec.CalcCoefficient10 = (decimal)s_CommonTempList[iy, (int)CommonTempListDef.ConstrTimesIndex]; |
|
535 |
calcs.Add(CurRec); |
|
536 |
} |
|
537 |
if (!CalcDB.InsertAction(calcs, false)) return false; |
|
538 |
|
|
539 |
return true; |
|
540 |
} |
|
541 |
catch (System.Exception ex) |
|
542 |
{ |
|
543 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
544 |
return false; |
|
545 |
} |
|
546 |
} |
|
547 |
private static bool ToDBCommonTempList2(IOCalcCoefficient CalcDB) |
|
548 |
{ |
|
549 |
try |
|
550 |
{ |
|
551 |
StringBuilder strSQL = new StringBuilder(); |
|
552 |
// 共通仮設費書込み |
|
553 |
strSQL.Append(CalcDB.CreatePrimarykeyString((int)CalcCoefficient.TypeCodeDef.CommonTemp2)); |
|
554 |
CalcDB.DeleteAction(strSQL.ToString(), false); |
|
555 |
|
|
556 |
CalcCoefficient CurRec = new CalcCoefficient(); |
|
557 |
CurRec.TypeCode = (int)CalcCoefficient.TypeCodeDef.CommonTemp2; |
|
558 |
CurRec.SeqNo = 1; |
|
559 |
CurRec.CalcCoefficient01 = (decimal)s_CommonTempList2[0]; |
|
560 |
CurRec.CalcCoefficient02 = (decimal)s_CommonTempList2[1]; |
|
561 |
CurRec.CalcCoefficient03 = (decimal)s_CommonTempList2[2]; |
|
562 |
CurRec.CalcCoefficient04 = (decimal)s_CommonTempList2[3]; |
|
563 |
CurRec.CalcCoefficient05 = (decimal)s_CommonTempList2[4]; |
|
564 |
CurRec.CalcCoefficient06 = (decimal)s_CommonTempList2[5]; |
|
565 |
|
|
566 |
if (!CalcDB.InsertAction(CurRec, false)) return false; |
|
567 |
|
|
568 |
return true; |
|
569 |
} |
|
570 |
catch (System.Exception ex) |
|
571 |
{ |
|
572 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
573 |
return false; |
|
574 |
} |
|
575 |
} |
|
576 |
#endregion |
|
577 |
|
|
578 |
#region 現場管理費書込み |
|
579 |
/// <summary> |
|
580 |
/// 現場管理費書込み |
|
581 |
/// </summary> |
|
582 |
private static bool ToDBFieldManageList1(IOCalcCoefficient CalcDB) |
|
583 |
{ |
|
584 |
try |
|
585 |
{ |
|
586 |
StringBuilder strSQL = new StringBuilder(); |
|
587 |
// 現場管理費書込み |
|
588 |
strSQL.Append(CalcDB.CreatePrimarykeyString((int)CalcCoefficient.TypeCodeDef.FieldManage)); |
|
589 |
CalcDB.DeleteAction(strSQL.ToString(), false); |
|
590 |
|
|
591 |
List<CalcCoefficient> calcs = new List<CalcCoefficient>(); |
|
592 |
for (int iy = 0; iy < s_FieldManageList.GetLength(0); iy++) |
|
593 |
{ |
|
594 |
CalcCoefficient CurRec = new CalcCoefficient(); |
|
595 |
CurRec.TypeCode = (int)CalcCoefficient.TypeCodeDef.FieldManage; |
|
596 |
CurRec.SeqNo = (iy + 1); |
|
597 |
CurRec.CalcCoefficient01 = (decimal)s_FieldManageList[iy, (int)ClsCostCulculation.CommonTempListDef.SetAmount]; |
|
598 |
CurRec.CalcCoefficient02 = (decimal)s_FieldManageList[iy, (int)CommonTempListDef.CoefficientLow]; |
|
599 |
CurRec.CalcCoefficient03 = (decimal)s_FieldManageList[iy, (int)CommonTempListDef.CoefficientHigh]; |
|
600 |
CurRec.CalcCoefficient04 = (decimal)s_FieldManageList[iy, (int)CommonTempListDef.CoefficientOverLow]; |
|
601 |
CurRec.CalcCoefficient05 = (decimal)s_FieldManageList[iy, (int)CommonTempListDef.CoefficientOverLowIndex]; |
|
602 |
CurRec.CalcCoefficient06 = (decimal)s_FieldManageList[iy, (int)CommonTempListDef.CoefficientOverHigh]; |
|
603 |
CurRec.CalcCoefficient07 = (decimal)s_FieldManageList[iy, (int)CommonTempListDef.CoefficientOverHighIndex]; |
|
604 |
CurRec.CalcCoefficient08 = (decimal)s_FieldManageList[iy, (int)CommonTempListDef.CommonCoefficient]; |
|
605 |
CurRec.CalcCoefficient09 = (decimal)s_FieldManageList[iy, (int)CommonTempListDef.ConstrCostsIndex]; |
|
606 |
CurRec.CalcCoefficient10 = (decimal)s_FieldManageList[iy, (int)CommonTempListDef.ConstrTimesIndex]; |
|
607 |
calcs.Add(CurRec); |
|
608 |
} |
|
609 |
if (!CalcDB.InsertAction(calcs, false)) return false; |
|
610 |
|
|
611 |
return true; |
|
612 |
} |
|
613 |
catch (System.Exception ex) |
|
614 |
{ |
|
615 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
616 |
return false; |
|
617 |
} |
|
618 |
} |
|
619 |
private static bool ToDBFieldManageList2(IOCalcCoefficient CalcDB) |
|
620 |
{ |
|
621 |
try |
|
622 |
{ |
|
623 |
StringBuilder strSQL = new StringBuilder(); |
|
624 |
// 現場管理費書込み |
|
625 |
strSQL.Append(CalcDB.CreatePrimarykeyString((int)CalcCoefficient.TypeCodeDef.FieldManage2)); |
|
626 |
CalcDB.DeleteAction(strSQL.ToString(), false); |
|
627 |
|
|
628 |
CalcCoefficient CurRec = new CalcCoefficient(); |
|
629 |
CurRec.TypeCode = (int)CalcCoefficient.TypeCodeDef.FieldManage2; |
|
630 |
CurRec.SeqNo = 1; |
|
631 |
CurRec.CalcCoefficient01 = (decimal)s_FieldManageList2[0]; |
|
632 |
CurRec.CalcCoefficient02 = (decimal)s_FieldManageList2[1]; |
|
633 |
CurRec.CalcCoefficient03 = (decimal)s_FieldManageList2[2]; |
|
634 |
CurRec.CalcCoefficient04 = (decimal)s_FieldManageList2[3]; |
|
635 |
CurRec.CalcCoefficient05 = (decimal)s_FieldManageList2[4]; |
|
636 |
CurRec.CalcCoefficient06 = (decimal)s_FieldManageList2[5]; |
|
637 |
|
|
638 |
if (!CalcDB.InsertAction(CurRec, false)) return false; |
|
639 |
|
|
640 |
return true; |
|
641 |
} |
|
642 |
catch (System.Exception ex) |
|
643 |
{ |
|
644 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
645 |
return false; |
|
646 |
} |
|
647 |
} |
|
648 |
#endregion |
|
649 |
|
|
650 |
#region 一般管理費書込み |
|
651 |
/// <summary> |
|
652 |
/// 一般管理費書込み |
|
653 |
/// </summary> |
|
654 |
private static bool ToDBGeneralManageList(IOCalcCoefficient CalcDB) |
|
655 |
{ |
|
656 |
try |
|
657 |
{ |
|
658 |
StringBuilder strSQL = new StringBuilder(); |
|
659 |
// 一般管理費書込み |
|
660 |
strSQL.Append(CalcDB.CreatePrimarykeyString((int)CalcCoefficient.TypeCodeDef.GeneralManage)); |
|
661 |
CalcDB.DeleteAction(strSQL.ToString(), false); |
|
662 |
|
|
663 |
List<CalcCoefficient> calcs = new List<CalcCoefficient>(); |
|
664 |
for (int iy = 0; iy < s_GeneralManageList.GetLength(0); iy++) |
|
665 |
{ |
|
666 |
CalcCoefficient CurRec = new CalcCoefficient(); |
|
667 |
CurRec.TypeCode = (int)CalcCoefficient.TypeCodeDef.GeneralManage; |
|
668 |
CurRec.SeqNo = (iy + 1); |
|
669 |
CurRec.CalcCoefficient01 = (decimal)s_GeneralManageList[iy, 0]; |
|
670 |
CurRec.CalcCoefficient02 = (decimal)s_GeneralManageList[iy, 1]; |
|
671 |
CurRec.CalcCoefficient03 = (decimal)s_GeneralManageList[iy, 2]; |
|
672 |
CurRec.CalcCoefficient04 = (decimal)s_GeneralManageList[iy, 3]; |
|
673 |
CurRec.CalcCoefficient05 = (decimal)s_GeneralManageList[iy, 4]; |
|
674 |
CurRec.CalcCoefficient06 = (decimal)s_GeneralManageList[iy, 5]; |
|
675 |
calcs.Add(CurRec); |
|
676 |
} |
|
677 |
if (!CalcDB.InsertAction(calcs, false)) return false; |
|
678 |
|
|
679 |
return true; |
|
680 |
} |
|
681 |
catch (System.Exception ex) |
|
682 |
{ |
|
683 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
684 |
return false; |
|
685 |
} |
|
686 |
} |
|
687 |
#endregion |
|
688 |
|
|
689 |
#region 共通仮設費計算(新営建築工事~回収機械設備工事) |
|
690 |
/// <summary> |
|
691 |
/// 共通仮設費計算(新営建築工事~回収機械設備工事) |
|
692 |
/// </summary> |
|
693 |
/// <param name="ExecNo">計算番号</param> |
|
694 |
/// <param name="ConstValue">直接工事費</param> |
|
695 |
/// <param name="ConstTimes">工期</param> |
|
696 |
/// <param name="CalValue">共通仮設費</param> |
|
697 |
/// <param name="HighValue">上限値</param> |
|
698 |
/// <param name="LowValue">下限値</param> |
|
699 |
/// <param name="ExecuteValue">使用共通仮設費率</param> |
|
700 |
public static void CalcCommonTempType1(int ExecNo, double ConstValue, double ConstTimes, |
|
701 |
ref double CalValue, ref double HighValue, ref double LowValue, ref double ExecuteValue) |
|
702 |
{ |
|
703 |
try |
|
704 |
{ |
|
705 |
// 金額で係数が違う |
|
706 |
if (ConstValue <= s_CommonTempList[ExecNo, (int)CommonTempListDef.SetAmount]) |
|
707 |
{ // 1千万円以下 |
|
708 |
|
|
709 |
// 1千万円で計算する(金額を千円単位にする) |
|
710 |
double BaseValue = (s_CommonTempList[ExecNo, (int)CommonTempListDef.SetAmount] / s_InputUnit); |
|
711 |
// 算定値 |
|
712 |
CalValue = s_CommonTempList[ExecNo, (int)CommonTempListDef.CommonCoefficient] |
|
713 |
* System.Math.Pow(BaseValue, s_CommonTempList[ExecNo, (int)CommonTempListDef.ConstrCostsIndex]) |
|
714 |
* System.Math.Pow(ConstTimes, s_CommonTempList[ExecNo, (int)CommonTempListDef.ConstrTimesIndex]); |
|
715 |
// 上限値 |
|
716 |
HighValue = s_CommonTempList[ExecNo, (int)CommonTempListDef.CoefficientHigh]; |
|
717 |
// 下限値 |
|
718 |
LowValue = s_CommonTempList[ExecNo, (int)CommonTempListDef.CoefficientLow]; |
|
719 |
} |
|
720 |
else |
|
721 |
{ // 1千万円超 |
|
722 |
// 金額を千円単位にする |
|
723 |
double BaseValue = (ConstValue / s_InputUnit); |
|
724 |
// 算定値 |
|
725 |
CalValue = s_CommonTempList[ExecNo, (int)CommonTempListDef.CommonCoefficient] |
|
726 |
* System.Math.Pow(BaseValue, s_CommonTempList[ExecNo, (int)CommonTempListDef.ConstrCostsIndex]) |
|
727 |
* System.Math.Pow(ConstTimes, s_CommonTempList[ExecNo, (int)CommonTempListDef.ConstrTimesIndex]); |
|
728 |
// 上限値 |
|
729 |
HighValue = s_CommonTempList[ExecNo, (int)CommonTempListDef.CoefficientOverHigh] |
|
730 |
* System.Math.Pow(BaseValue, s_CommonTempList[ExecNo, (int)CommonTempListDef.CoefficientOverHighIndex]); |
|
731 |
// 下限値 |
|
732 |
LowValue = s_CommonTempList[ExecNo, (int)CommonTempListDef.CoefficientOverLow] |
|
733 |
* System.Math.Pow(BaseValue, s_CommonTempList[ExecNo, (int)CommonTempListDef.CoefficientOverLowIndex]); |
|
734 |
} |
|
735 |
|
|
736 |
ExecuteValue = CalValue; |
|
737 |
// 上限越 |
|
738 |
if (HighValue < CalValue) ExecuteValue = HighValue; |
|
739 |
// 下限未満 |
|
740 |
if (CalValue < LowValue) ExecuteValue = LowValue; |
|
741 |
|
|
742 |
} |
|
743 |
catch (Exception ex) |
|
744 |
{ |
|
745 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
746 |
} |
|
747 |
} |
|
748 |
#endregion |
|
749 |
|
|
750 |
#region 共通仮設費計算(昇降機設備工事) |
|
751 |
/// <summary> |
|
752 |
/// 共通仮設費計算(昇降機設備工事) |
|
753 |
/// </summary> |
|
754 |
/// <param name="ConstValue"></param> |
|
755 |
/// <param name="CalValue"></param> |
|
756 |
public static void CalcCommonTempType2(double ConstValue, ref double CalValue) |
|
757 |
{ |
|
758 |
try |
|
759 |
{ |
|
760 |
// 金額を千円単位にする |
|
761 |
double BaseValue = (ConstValue / s_InputUnit); |
|
762 |
|
|
763 |
// 金額で係数が違う |
|
764 |
if (ConstValue <= s_CommonTempList2[0]) |
|
765 |
{ // 1千万円以下 |
|
766 |
CalValue = s_CommonTempList2[1]; |
他の形式にエクスポート: Unified diff