リビジョン 491
製品版を最新にマージ:オリジナルリビジョン607相当
CommonMotions.cs | ||
---|---|---|
1073 | 1073 |
} |
1074 | 1074 |
#endregion |
1075 | 1075 |
|
1076 |
#region TimeSpanから年数を取得する |
|
1077 |
/// <summary> |
|
1078 |
/// TimeSpanから年数を取得する(切り上げ) |
|
1079 |
/// </summary> |
|
1080 |
/// <param name="timespan"></param> |
|
1081 |
/// <returns></returns> |
|
1082 |
public static int GetTimeSpanYears(this TimeSpan timespan) |
|
1083 |
{ |
|
1084 |
return CommonMotions.cnvRoundUp((double)timespan.Days / 365.2425); |
|
1085 |
} |
|
1076 | 1086 |
#endregion |
1077 | 1087 |
|
1088 |
#region TimeSpanから月数を取得する |
|
1089 |
/// <summary> |
|
1090 |
/// TimeSpanから月数を取得する |
|
1091 |
/// </summary> |
|
1092 |
/// <param name="timespan"></param> |
|
1093 |
/// <returns></returns> |
|
1094 |
public static int GetTimeSpanMonths(this TimeSpan timespan) |
|
1095 |
{ |
|
1096 |
return (int)((double)timespan.Days / 30.436875); |
|
1097 |
} |
|
1098 |
#endregion |
|
1099 |
|
|
1100 |
#endregion |
|
1101 |
|
|
1078 | 1102 |
#region ---------- データチェックメソッド |
1079 | 1103 |
#region ディレクトリの存在チェック |
1080 | 1104 |
/// <summary> |
... | ... | |
2375 | 2399 |
|
2376 | 2400 |
strSQL.AppendFormat(" WHERE (DATE(BeginDate) <= DATE('{0}'))", NowDay.ToShortDateString()); |
2377 | 2401 |
strSQL.AppendFormat(" AND (DATE('{0}') <= DATE(CompleteDate))", NowDay.ToShortDateString()); |
2378 |
strSQL.AppendFormat(" And PeriodFlag = {0}", CommonMotions.SystemMasterData.ConstructionNoBase); |
|
2402 |
|
|
2403 |
int nFlag = (int)BizPeriodHistory.PeriodFlagDef.BizPeriod; |
|
2404 |
if (CommonMotions.BasePeriodYear()) |
|
2405 |
{ |
|
2406 |
// 期を選択している場合 |
|
2407 |
nFlag = (int)BizPeriodHistory.PeriodFlagDef.BizPeriod; |
|
2408 |
} |
|
2409 |
else |
|
2410 |
{ |
|
2411 |
// 年を選択している場合 |
|
2412 |
nFlag = (int)BizPeriodHistory.PeriodFlagDef.ConstrYear; |
|
2413 |
} |
|
2414 |
strSQL.AppendFormat(" And PeriodFlag = {0}", nFlag); |
|
2379 | 2415 |
strSQL.Append(" Order By PeriodFlag Asc, PeriodYear Asc"); |
2380 | 2416 |
|
2381 | 2417 |
List<BizPeriodHistory> BizList = new List<BizPeriodHistory>(); |
... | ... | |
2987 | 3023 |
} |
2988 | 3024 |
#endregion |
2989 | 3025 |
|
2990 |
#region TimeSpanから年数を取得する |
|
2991 |
/// <summary> |
|
2992 |
/// TimeSpanから年数を取得する(切り上げ) |
|
2993 |
/// </summary> |
|
2994 |
/// <param name="timespan"></param> |
|
2995 |
/// <returns></returns> |
|
2996 |
public static int GetTimeSpanYears(this TimeSpan timespan) |
|
2997 |
{ |
|
2998 |
return CommonMotions.cnvRoundUp((double)timespan.Days / 365.2425); |
|
2999 |
} |
|
3000 |
#endregion |
|
3001 |
|
|
3002 |
#region TimeSpanから月数を取得する |
|
3003 |
/// <summary> |
|
3004 |
/// TimeSpanから月数を取得する |
|
3005 |
/// </summary> |
|
3006 |
/// <param name="timespan"></param> |
|
3007 |
/// <returns></returns> |
|
3008 |
public static int GetTimeSpanMonths(this TimeSpan timespan) |
|
3009 |
{ |
|
3010 |
return (int)((double)timespan.Days / 30.436875); |
|
3011 |
} |
|
3012 |
#endregion |
|
3013 |
|
|
3014 | 3026 |
#region 工事種別より工事詳細台帳が作成OKかどうかをチェックする |
3015 | 3027 |
/// <summary> |
3016 | 3028 |
/// 工事種別より工事詳細台帳が作成OKかどうかをチェックする |
... | ... | |
3028 | 3040 |
}; |
3029 | 3041 |
for (int i = 0; i < Status.Length; i++) |
3030 | 3042 |
{ |
3031 |
//if (ConstructionStatusFlg == Status[i] && ConstructionType == CommonDefine.s_CreateLedgerData[i]) |
|
3032 | 3043 |
if (ConstructionStatusFlg == Status[i]) |
3033 | 3044 |
{ |
3034 | 3045 |
ExcuteFlg = true; |
... | ... | |
3061 | 3072 |
// 日当計算 |
3062 | 3073 |
double DairySalary = 0; |
3063 | 3074 |
if (bSalaryCorrection) |
3075 |
{ |
|
3064 | 3076 |
DairySalary = (MonthryCost * CommonDefine.s_SalaryCorrection) / CommonDefine.s_ManHourUnitMonth; |
3077 |
} |
|
3065 | 3078 |
else |
3066 | 3079 |
{ |
3067 | 3080 |
DairySalary = MonthryCost / CommonDefine.s_ManHourUnitMonth; |
... | ... | |
4076 | 4089 |
strSQL.Append(" On AB.PersonCode = AA.PersonCode"); |
4077 | 4090 |
strSQL.Append(" INNER JOIN DEPARTMENTMASTER As A"); |
4078 | 4091 |
strSQL.Append(" On A.DepartmentCode = AA.DepartmentCode"); |
4079 |
if (bNowSeason) |
|
4092 |
if (!bNowSeason)
|
|
4080 | 4093 |
{ |
4081 |
// 今期のプライマリテーブルは部署マスタ |
|
4082 |
//strSQL.AppendFormat(" And A.DELETEFLG = {0}", (int)CommonDefine.DataDeleteDef.Exists); |
|
4083 |
} |
|
4084 |
else |
|
4085 |
{ |
|
4086 | 4094 |
if (bConstrBase) |
4087 | 4095 |
{ |
4088 | 4096 |
// 過去のデータは工事情報より取得する |
... | ... | |
4192 | 4200 |
strSQL.Append(" On C.ConstrDepCode = A.DepartmentCode"); |
4193 | 4201 |
} |
4194 | 4202 |
|
4195 |
// 台帳計算対象外は外す |
|
4196 |
//if (bLedgerDivNo) strSQL.Append(", PERSONINCHARGEMASTER B"); |
|
4197 |
|
|
4198 | 4203 |
strSQL.Append(" WHERE"); |
4199 | 4204 |
strSQL.AppendFormat(" AA.PersonCode = {0}", CommonMotions.LoginUserData.PersonCode); |
4200 | 4205 |
|
... | ... | |
4204 | 4209 |
if (bNowSeason) |
4205 | 4210 |
{ |
4206 | 4211 |
// 対象が今期の場合 |
4207 |
//strSQL.AppendFormat(" And DATE(A.StartDate) <= DATE('{0}')", dtDefaultEnd.ToShortDateString()); |
|
4208 | 4212 |
// 開始日が今日より小さい |
4209 | 4213 |
strSQL.AppendFormat(" And DATE(A.StartDate) <= DATE('{0}')", DateTime.Today.ToShortDateString()); |
4210 | 4214 |
|
... | ... | |
4220 | 4224 |
else |
4221 | 4225 |
{ |
4222 | 4226 |
strSQL.AppendFormat(" AND DATE('{0}') <= DATE(AB.CompDate)", dtDefaultEnd.ToShortDateString()); |
4223 |
|
|
4224 |
//strSQL.AppendFormat(" AND ((DATE(AB.STARTDATE) <= DATE('{0}'))", dtDefaultEnd.ToShortDateString()); |
|
4225 |
//strSQL.AppendFormat(" AND(DATE('{0}') <= DATE(AB.CompDate)", dtDefaultStart.ToShortDateString()); |
|
4226 |
//strSQL.AppendFormat(" OR DATE('{0}') = DATE(AB.CompDate)))", DateTime.MinValue.ToShortDateString()); |
|
4227 | 4227 |
} |
4228 | 4228 |
|
4229 |
strSQL.Append(" And"); |
|
4230 |
|
|
4229 | 4231 |
if (bNowSeason) |
4230 |
strSQL.Append(" And ("); |
|
4231 |
else |
|
4232 |
strSQL.Append(" And"); |
|
4232 |
strSQL.Append(" ("); |
|
4233 | 4233 |
|
4234 |
strSQL.Append(" (0 < (SELECT COUNT(*) FROM constructionbaseinfo AS BX");
|
|
4234 |
strSQL.Append(" Exists (SELECT * FROM constructionbaseinfo AS BX");
|
|
4235 | 4235 |
|
4236 | 4236 |
if (CommonMotions.BasePeriodYear()) |
4237 | 4237 |
strSQL.AppendFormat(" Where BX.ConstructionPeriod = {0}", nTargetCount); |
4238 | 4238 |
else |
4239 | 4239 |
strSQL.AppendFormat(" Where BX.ConstructionYear = {0}", nTargetCount); |
4240 |
|
|
4240 | 4241 |
strSQL.Append(" AND (BX.SalesDepCode = AA.DepartmentCode"); |
4242 |
strSQL.Append(" Or BX.SalesSubDepCode = AA.DepartmentCode"); |
|
4241 | 4243 |
strSQL.Append(" Or BX.ConstrDepCode = AA.DepartmentCode"); |
4242 | 4244 |
strSQL.Append(" Or BX.ConstrSubDepCode = AA.DepartmentCode"); |
4243 |
strSQL.Append(" Or BX.ConstrInstrDepCode = AA.DepartmentCode)))");
|
|
4245 |
strSQL.Append(" Or BX.ConstrInstrDepCode = AA.DepartmentCode))"); |
|
4244 | 4246 |
|
4245 | 4247 |
if (bNowSeason) |
4246 | 4248 |
{ |
4247 |
strSQL.Append(" Or (0 < (SELECT COUNT(*) FROM PERSONINCHARGEMASTER AS B");
|
|
4249 |
strSQL.Append(" Or Exists (SELECT * FROM PERSONINCHARGEMASTER AS B");
|
|
4248 | 4250 |
strSQL.Append(" WHERE B.DepartmentCode = AA.DepartmentCode"); |
4249 | 4251 |
// 台帳計算対象のみ |
4250 | 4252 |
if (!bLedgerDivNo) strSQL.AppendFormat(" And B.LedgerFlg = {0}", (int)PersonInChargeMaster.LedgerDivNoDef.CalcTarget); |
4251 | 4253 |
// 今期は削除されていないもののみ |
4252 |
strSQL.AppendFormat(" And B.DeleteFlg = {0})))", (int)CommonDefine.DataDeleteDef.Exists);
|
|
4254 |
strSQL.AppendFormat(" And B.DeleteFlg = {0}))", (int)CommonDefine.DataDeleteDef.Exists); |
|
4253 | 4255 |
} |
4254 | 4256 |
|
4255 | 4257 |
strSQL.Append(" GROUP BY A.DEPARTMENTCODE, A.DEPARTMENTSTRING, A.DISPLAYORDER"); |
... | ... | |
4281 | 4283 |
DateTime dtDefaultStart = CommonMotions.GetOpeningEndDate(nTargetYear, true); |
4282 | 4284 |
DateTime dtDefaultEnd = CommonMotions.GetOpeningEndDate(nTargetYear, false); |
4283 | 4285 |
|
4284 |
strSQL.AppendFormat("Select {0} From", IOMPersonInCharge.CreateFieldNameList("A.")); |
|
4285 |
strSQL.Append(" personinchargemaster As A"); |
|
4286 |
strSQL.Append(" Left Join chgchargedep As B"); |
|
4287 |
strSQL.Append(" On B.PersonCode = A.PersonCode"); |
|
4286 |
strSQL.Append("Select"); |
|
4287 |
strSQL.AppendFormat(" {0}", IOMPersonInCharge.CreateFieldNameList("A.")); |
|
4288 |
strSQL.Append(" From personinchargemaster As A"); |
|
4289 |
strSQL.Append(" Left Join chgchargedep As B"); |
|
4290 |
strSQL.Append(" On B.PersonCode = A.PersonCode"); |
|
4288 | 4291 |
|
4289 | 4292 |
strSQL.Append(" WHERE"); |
4290 | 4293 |
strSQL.AppendFormat(" ((DATE(A.STARTDATE) <= DATE('{0}'))", dtDefaultEnd.ToShortDateString()); |
他の形式にエクスポート: Unified diff