リビジョン 344
期数選択numupdown:選択時部署変更にバグあり修正
工事台帳明細に担当者部署コード追加
未作成台帳:作成済み、完了前を一覧に追加
台帳部署一覧・台帳一覧:データ無時クリア処理追加
台帳・売上げグラフ:データ差異があったため修正
| branches/src/ProcessManagement/ProcessManagement/Common/CommonMotions.cs | ||
|---|---|---|
| 2937 | 2937 |
bool bFirst = true; |
| 2938 | 2938 |
foreach (object[] ObjRec in TargetList) |
| 2939 | 2939 |
{
|
| 2940 |
int PersonCode = CommonMotions.cnvInt(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.PersonCode]);
|
|
| 2941 |
DateTime dtStart = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.StartDate]);
|
|
| 2942 |
DateTime dtLast = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.CompDate]);
|
|
| 2940 |
int PersonCode = CommonMotions.cnvInt(ObjRec[(int)CommonLedgerData.GetPersonTerm.PersonCode]);
|
|
| 2941 |
DateTime dtStart = CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.StartDate]);
|
|
| 2942 |
DateTime dtLast = CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.CompDate]);
|
|
| 2943 | 2943 |
|
| 2944 | 2944 |
if (!bFirst) strSQL.Append(" UNION ");
|
| 2945 | 2945 |
|
| ... | ... | |
| 3063 | 3063 |
foreach (object[] ObjRec in TargetList) |
| 3064 | 3064 |
{
|
| 3065 | 3065 |
// 開始・終了日が無い場合はデフォルトの期首・期末を使用する |
| 3066 |
DateTime stDate = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.StartDate]);
|
|
| 3067 |
DateTime edDate = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.CompDate]);
|
|
| 3066 |
DateTime stDate = CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.StartDate]);
|
|
| 3067 |
DateTime edDate = CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.CompDate]);
|
|
| 3068 | 3068 |
CalcStartCompDate(TargetYear, |
| 3069 | 3069 |
dtDefaultStart, dtDefaultEnd, |
| 3070 |
CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.HireStartDays]),
|
|
| 3071 |
CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.HireCompDays]),
|
|
| 3072 |
CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.NextStartDate]),
|
|
| 3073 |
CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.NextCompDate]),
|
|
| 3070 |
CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.HireStartDays]),
|
|
| 3071 |
CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.HireCompDays]),
|
|
| 3072 |
CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.NextStartDate]),
|
|
| 3073 |
CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.NextCompDate]),
|
|
| 3074 | 3074 |
ref stDate, ref edDate); |
| 3075 | 3075 |
|
| 3076 |
int nPersonCode = CommonMotions.cnvInt(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.PersonCode]);
|
|
| 3076 |
int nPersonCode = CommonMotions.cnvInt(ObjRec[(int)CommonLedgerData.GetPersonTerm.PersonCode]);
|
|
| 3077 | 3077 |
wrkStEdDate.Add(new KeyValuePair<DateTime, DateTime>(stDate, edDate)); |
| 3078 | 3078 |
|
| 3079 | 3079 |
// 今期の最初が先期の最後より大きい場合は処理しない |
| ... | ... | |
| 3142 | 3142 |
int DateCnt = 0; |
| 3143 | 3143 |
foreach (object[] ObjRec in TargetList) |
| 3144 | 3144 |
{
|
| 3145 |
int nPersonCode = CommonMotions.cnvInt(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.PersonCode]);
|
|
| 3145 |
int nPersonCode = CommonMotions.cnvInt(ObjRec[(int)CommonLedgerData.GetPersonTerm.PersonCode]);
|
|
| 3146 | 3146 |
|
| 3147 | 3147 |
// 半端分の日数を取得する |
| 3148 | 3148 |
int NextDiffDay = ArData.Cast<object[]>().Where(x => CommonMotions.cnvInt(x[0]) == TargetYear |
| ... | ... | |
| 3158 | 3158 |
// 今期終了日変更 |
| 3159 | 3159 |
DateTime wrkDate = CurStEd.Value.AddDays(NextDiffDay); |
| 3160 | 3160 |
if (dtDefaultEnd.Date < wrkDate.Date) wrkDate = dtDefaultEnd; |
| 3161 |
ObjRec[(int)CreateLedgerSQL.GetPersonTerm.CompDate] = wrkDate;
|
|
| 3161 |
ObjRec[(int)CommonLedgerData.GetPersonTerm.CompDate] = wrkDate;
|
|
| 3162 | 3162 |
// 今期開始日変更 |
| 3163 | 3163 |
wrkDate = CurStEd.Key.AddDays(PrevDiffDay); |
| 3164 | 3164 |
if (dtDefaultEnd.Date < wrkDate.Date) wrkDate = dtDefaultEnd; |
| 3165 |
ObjRec[(int)CreateLedgerSQL.GetPersonTerm.StartDate] = wrkDate;
|
|
| 3165 |
ObjRec[(int)CommonLedgerData.GetPersonTerm.StartDate] = wrkDate;
|
|
| 3166 | 3166 |
} |
| 3167 | 3167 |
|
| 3168 | 3168 |
} |
| branches/src/ProcessManagement/ProcessManagement/Common/CommonVersion.cs | ||
|---|---|---|
| 14 | 14 |
/// <summary> |
| 15 | 15 |
/// 本体バージョン |
| 16 | 16 |
/// </summary> |
| 17 |
public static int s_SystemVersion = 181;
|
|
| 17 |
public static int s_SystemVersion = 192;
|
|
| 18 | 18 |
|
| 19 | 19 |
/// <summary> |
| 20 | 20 |
/// コピー・環境バージョン |
| branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ApprovalList/FrmApprovalListAuxiliary.cs | ||
|---|---|---|
| 397 | 397 |
{
|
| 398 | 398 |
cmbConstructionPerson.SelectedIndexChanged -= new EventHandler(this.cmbConstructionPerson_SelectedIndexChanged); |
| 399 | 399 |
int nBeforeCode = CommonMotions.cnvInt(cmbConstructionPerson.SelectedValue); |
| 400 |
if (CommonMotions.cnvInt(cmbDepartment.SelectedValue) < 1) nBeforeCode = 0; |
|
| 400 | 401 |
|
| 401 | 402 |
cmbConstructionPerson.DataSource = null; |
| 402 | 403 |
cmbConstructionPerson.Items.Clear(); |
| ... | ... | |
| 1298 | 1299 |
PersonRec.DepartmentCode = CommonMotions.cnvInt(objRec[2]); // ?????R?[?h |
| 1299 | 1300 |
|
| 1300 | 1301 |
// ????????????????????? |
| 1301 |
if (DepartmentCode == PersonRec.DepartmentCode) return true; |
|
| 1302 |
//if (DepartmentCode == PersonRec.DepartmentCode) return true;
|
|
| 1302 | 1303 |
|
| 1303 | 1304 |
// ?????R???{?{?b?N?X??????R?[?h?Z?b?g
|
| 1305 |
SetcmbDepartment(); |
|
| 1304 | 1306 |
cmbDepartment.SelectedValue = PersonRec.DepartmentCode; |
| 1305 | 1307 |
SetcmbPersons(); // ?S????R???{?{?b?N?X??X
|
| 1306 | 1308 |
cmbConstructionPerson.SelectedValue = PersonCode; |
| branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstractionList/FrmConstructionListAuxiliary.cs | ||
|---|---|---|
| 2142 | 2142 |
{
|
| 2143 | 2143 |
cmbConstructionPerson.SelectedIndexChanged -= new EventHandler(cmbConstructionPerson_SelectedIndexChanged); |
| 2144 | 2144 |
int nBeforeCode = CommonMotions.cnvInt(cmbConstructionPerson.SelectedValue); |
| 2145 |
if (CommonMotions.cnvInt(cmbDepartment.SelectedValue) < 1) nBeforeCode = 0; |
|
| 2145 | 2146 |
|
| 2146 | 2147 |
cmbConstructionPerson.DataSource = null; |
| 2147 | 2148 |
cmbConstructionPerson.Items.Clear(); |
| ... | ... | |
| 2221 | 2222 |
PersonRec.DepartmentCode = CommonMotions.cnvInt(objRec[2]); // ?????R?[?h |
| 2222 | 2223 |
|
| 2223 | 2224 |
// ????????????????????? |
| 2224 |
if (DepartmentCode == PersonRec.DepartmentCode) return true; |
|
| 2225 |
//if (DepartmentCode == PersonRec.DepartmentCode) return true;
|
|
| 2225 | 2226 |
|
| 2226 | 2227 |
// ?????R???{?{?b?N?X??????R?[?h?Z?b?g
|
| 2228 |
SetcmbDepartment(); |
|
| 2227 | 2229 |
cmbDepartment.SelectedValue = PersonRec.DepartmentCode; |
| 2228 | 2230 |
SetcmbPersons(); // ?S????R???{?{?b?N?X??X
|
| 2229 | 2231 |
cmbConstructionPerson.SelectedValue = PersonCode; |
| branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionBaseInfo/DataChange.cs | ||
|---|---|---|
| 1023 | 1023 |
|
| 1024 | 1024 |
/// ?f?[?^?Z?b?g |
| 1025 | 1025 |
object[] objRec = (object[])ParentData[0]; |
| 1026 |
|
|
| 1026 |
|
|
| 1027 | 1027 |
// ----- ?H??????????f?[?^???? |
| 1028 | 1028 |
// ?H???S???? |
| 1029 | 1029 |
bool bChgParson1 = false; |
| 1030 |
if (!LedgerDetailDataSalarySet(LedgerDDB, LedgerEDB,ProcConstrCode, frm, TotalOrdersPrice, |
|
| 1030 |
if (!LedgerDetailDataSalarySet(LedgerDDB, LedgerEDB, ProcConstrCode, frm, TotalOrdersPrice,
|
|
| 1031 | 1031 |
(int)FrmConstructionLedger.DataGroup.Payroll, |
| 1032 | 1032 |
objRec, LedgerRec, ref bChgParson1)) return false; |
| 1033 | 1033 |
|
| ... | ... | |
| 1120 | 1120 |
try |
| 1121 | 1121 |
{
|
| 1122 | 1122 |
// ??W?f?[?^?? |
| 1123 |
int TargetParson1 = CommonMotions.cnvInt(((ComboBox)m_DspCtrl[(int)DspCnt.ConstructionPersonCode]).SelectedValue); // ?S???? |
|
| 1124 |
int TargetParson2 = CommonMotions.cnvInt(((ComboBox)m_DspCtrl[(int)DspCnt.ConstrSubPersonCode]).SelectedValue); // ???S???? |
|
| 1125 |
int TargetParson3 = CommonMotions.cnvInt(((ComboBox)m_DspCtrl[(int)DspCnt.ConstructionInstructor]).SelectedValue); // ?w???? |
|
| 1123 |
int TargetDepment1 = CommonMotions.cnvInt(((ComboBox)m_DspCtrl[(int)DspCnt.ConstructionDepartment]).SelectedValue); // ?S??????? |
|
| 1124 |
int TargetParson1 = CommonMotions.cnvInt(((ComboBox)m_DspCtrl[(int)DspCnt.ConstructionPersonCode]).SelectedValue); // ?S???? |
|
| 1125 |
int TargetDepment2 = CommonMotions.cnvInt(((ComboBox)m_DspCtrl[(int)DspCnt.ConstrSubDepartment]).SelectedValue); // ???S??????? |
|
| 1126 |
int TargetParson2 = CommonMotions.cnvInt(((ComboBox)m_DspCtrl[(int)DspCnt.ConstrSubPersonCode]).SelectedValue); // ???S???? |
|
| 1127 |
int TargetDepment3 = CommonMotions.cnvInt(((ComboBox)m_DspCtrl[(int)DspCnt.InstructorDepartment]).SelectedValue); // ?w???????? |
|
| 1128 |
int TargetParson3 = CommonMotions.cnvInt(((ComboBox)m_DspCtrl[(int)DspCnt.ConstructionInstructor]).SelectedValue); // ?w???? |
|
| 1129 |
|
|
| 1126 | 1130 |
DateTime StartDate = CommonMotions.cnvUndecidedStringToDate(m_DspCtrl[(int)DspCnt.ConstructionPeriodStart2].Text); |
| 1127 | 1131 |
if (StartDate == DateTime.MinValue) |
| 1128 | 1132 |
StartDate = CommonMotions.cnvUndecidedStringToDate(m_DspCtrl[(int)DspCnt.ConstructionPeriodStart].Text); |
| ... | ... | |
| 1139 | 1143 |
bool bExists = LedgerDDB.SelectAction(strSQL.ToString(), ref DetailRec, false); |
| 1140 | 1144 |
|
| 1141 | 1145 |
int ConstructorCode = 0; |
| 1146 |
int DepartmentCode = 0; |
|
| 1142 | 1147 |
double MonthryCost = 0; |
| 1143 | 1148 |
switch (GroupCode) |
| 1144 | 1149 |
{
|
| 1145 | 1150 |
// ?H???S???? |
| 1146 | 1151 |
case (int)FrmConstructionLedger.DataGroup.Payroll: |
| 1147 | 1152 |
ConstructorCode = TargetParson1; |
| 1153 |
DepartmentCode = TargetDepment1; |
|
| 1148 | 1154 |
MonthryCost = CommonMotions.cnvDouble(objRec[(int)ReadParentOrder.ConstrPersonSalary]); |
| 1149 | 1155 |
break; |
| 1150 | 1156 |
// ?H?????S???? |
| 1151 | 1157 |
case (int)FrmConstructionLedger.DataGroup.Assistant: |
| 1152 | 1158 |
ConstructorCode = TargetParson2; |
| 1159 |
DepartmentCode = TargetDepment2; |
|
| 1153 | 1160 |
MonthryCost = CommonDefine.AssistantMonthryCost; |
| 1154 | 1161 |
break; |
| 1155 | 1162 |
|
| 1156 | 1163 |
// ?H???w???? |
| 1157 | 1164 |
case (int)FrmConstructionLedger.DataGroup.Instructor: |
| 1158 | 1165 |
ConstructorCode = TargetParson3; |
| 1166 |
DepartmentCode = TargetDepment3; |
|
| 1159 | 1167 |
MonthryCost = CommonDefine.InstructorMonthryCost; |
| 1160 | 1168 |
break; |
| 1161 | 1169 |
} |
| ... | ... | |
| 1214 | 1222 |
NewDetailRec.FirstString = frm.GetTitleString; // ??????? |
| 1215 | 1223 |
|
| 1216 | 1224 |
NewDetailRec.SecondString = string.Empty; // ?H?????e |
| 1225 |
NewDetailRec.ComponentCode = DepartmentCode; // ?S????????R?[?h |
|
| 1217 | 1226 |
NewDetailRec.CompanyType = (int)CommonDefine.CodeDataType.Person; // ??????R?[?h?^?C?v |
| 1218 |
NewDetailRec.CompanyCode = ConstructorCode; // ??????R?[?h
|
|
| 1227 |
NewDetailRec.CompanyCode = ConstructorCode; // ?S????R?[?h
|
|
| 1219 | 1228 |
NewDetailRec.ExecutionAmount = 0; // ???s???z |
| 1220 | 1229 |
NewDetailRec.AmountConfigRate = 0; // ???z?\???? |
| 1221 | 1230 |
|
| branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionBudget/FrmConstructionBudgetAuxiliary.cs | ||
|---|---|---|
| 4615 | 4615 |
// 金額の編集 |
| 4616 | 4616 |
CurCell.Value = CommonMotions.cnvInt(CurCell.Value).ToString("#,0");
|
| 4617 | 4617 |
|
| 4618 |
// 希望金額が実行金額より小さい場合は金額セット |
|
| 4618 |
// 希望金額が実行金額より小さい場合は金額セット(希望金額が0にセットされた場合はセットする)
|
|
| 4619 | 4619 |
int nHopePrice = CommonMotions.cnvInt(CurRow.Cells[(int)GridColumn.HopePrice].Value); |
| 4620 | 4620 |
int nExecPrice = CommonMotions.cnvInt(CurRow.Cells[(int)GridColumn.ExecPrice].Value); |
| 4621 |
if (nExecPrice == 0 || nHopePrice < nExecPrice) |
|
| 4621 |
if (nExecPrice == 0 || nHopePrice < nExecPrice || nHopePrice == 0)
|
|
| 4622 | 4622 |
CurRow.Cells[(int)GridColumn.ExecPrice].Value = CurCell.Value; |
| 4623 | 4623 |
break; |
| 4624 | 4624 |
default: |
| branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionJoin/FrmConstructionJoinAuxiliary.cs | ||
|---|---|---|
| 316 | 316 |
{
|
| 317 | 317 |
cmbConstructionPerson.SelectedIndexChanged -= new EventHandler(cmbConstructionPerson_SelectedIndexChanged); |
| 318 | 318 |
int nBeforeCode = CommonMotions.cnvInt(cmbConstructionPerson.SelectedValue); |
| 319 |
if (CommonMotions.cnvInt(cmbDepartment.SelectedValue) < 1) nBeforeCode = 0; |
|
| 319 | 320 |
|
| 320 | 321 |
cmbConstructionPerson.DataSource = null; |
| 321 | 322 |
cmbConstructionPerson.Items.Clear(); |
| ... | ... | |
| 396 | 397 |
PersonRec.DepartmentCode = CommonMotions.cnvInt(objRec[2]); // 部署コード |
| 397 | 398 |
|
| 398 | 399 |
// 同じ部署の場合は処理しない |
| 399 |
if (DepartmentCode == PersonRec.DepartmentCode) return true; |
|
| 400 |
//if (DepartmentCode == PersonRec.DepartmentCode) return true;
|
|
| 400 | 401 |
|
| 401 | 402 |
// 部署コンボボックスへ部署コードセット |
| 403 |
SetcmbDepartment(); |
|
| 402 | 404 |
cmbDepartment.SelectedValue = PersonRec.DepartmentCode; |
| 403 | 405 |
SetcmbPersons(); // 担当者コンボボックス変更 |
| 404 | 406 |
cmbConstructionPerson.SelectedValue = PersonCode; |
| branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedger/FrmConstructionLedgerAuxiliary.cs | ||
|---|---|---|
| 1574 | 1574 |
try |
| 1575 | 1575 |
{
|
| 1576 | 1576 |
// 工事予算書明細データを読み込む |
| 1577 |
string strSQL = DetailDB.CreatePrimarykeyString(m_ConstructionCode); |
|
| 1578 |
strSQL += string.Format(" AND GROUPCOUNT IN ({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11})",
|
|
| 1577 |
StringBuilder strSQL = new StringBuilder(); |
|
| 1578 |
strSQL.Append(DetailDB.CreatePrimarykeyString(m_ConstructionCode)); |
|
| 1579 |
strSQL.AppendFormat(" AND GROUPCOUNT IN ({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11})",
|
|
| 1579 | 1580 |
(int)FrmConstructionBudget.DataGroup.CommonTempCosts, // 共通仮設 |
| 1580 | 1581 |
(int)FrmConstructionBudget.DataGroup.OutSourceCosts, // 外注費 |
| 1581 | 1582 |
(int)FrmConstructionBudget.DataGroup.MyConstruction, // 自社施工 |
| ... | ... | |
| 1590 | 1591 |
(int)FrmConstructionBudget.DataGroup.PayrollExpenses // 担当者給与経費 |
| 1591 | 1592 |
); |
| 1592 | 1593 |
|
| 1593 |
strSQL += " ORDER BY GroupCount ASC, LineCount ASC";
|
|
| 1594 |
DetailDB.SelectAction(strSQL, ref DetailList); |
|
| 1594 |
strSQL.Append(" ORDER BY GroupCount ASC, LineCount ASC");
|
|
| 1595 |
DetailDB.SelectAction(strSQL.ToString(), ref DetailList);
|
|
| 1595 | 1596 |
} |
| 1596 | 1597 |
catch (Exception ex) |
| 1597 | 1598 |
{
|
| ... | ... | |
| 2208 | 2209 |
int TotalPoint = dgv.ColumnCount + (int)ColPayTotal.Totals; |
| 2209 | 2210 |
// 支払可能額欄位置取得 |
| 2210 | 2211 |
int ResultPoint = dgv.ColumnCount + (int)ColPayTotal.Results; |
| 2212 |
|
|
| 2213 |
|
|
| 2214 |
DataGridViewRow[] WorkRow = null; |
|
| 2215 |
// 対象データ取得(グループが純利益より小さいもの) |
|
| 2216 |
int nGrpNo = (int)GridColumn.GroupCount; |
|
| 2211 | 2217 |
// 純利益数の取得 |
| 2212 | 2218 |
int BreakLine = m_CostsRowCount[(int)CostsRowLine.NetIncomeRowLine]; |
| 2213 | 2219 |
// 純利益が表示されていなければグリッド最大行をセット |
| 2214 |
if (BreakLine == 0) BreakLine = dgv.Rows.Count; |
|
| 2220 |
if (BreakLine == 0) |
|
| 2221 |
{
|
|
| 2222 |
WorkRow = dgv.Rows.Cast<DataGridViewRow>().ToArray(); |
|
| 2223 |
} |
|
| 2224 |
else |
|
| 2225 |
{
|
|
| 2226 |
WorkRow = dgv.Rows.Cast<DataGridViewRow>().Where(x => CommonMotions.cnvInt(x.Cells[nGrpNo].Value) < (int)DataGroup.NetIncome) |
|
| 2227 |
.ToArray(); |
|
| 2228 |
} |
|
| 2229 |
EstimateValue = WorkRow.Sum(y => CommonMotions.cnvInt(y.Cells[(int)GridColumn.EstimatePrice].Value)); // 積算時見積金額 |
|
| 2230 |
ExecValue = WorkRow.Sum(y => CommonMotions.cnvInt(y.Cells[(int)GridColumn.ExecPrice].Value)); // 実行金額 |
|
| 2231 |
PercentValue = WorkRow.Sum(y => CommonMotions.cnvDouble(y.Cells[(int)GridColumn.Percent].Value)); // 構成比率 |
|
| 2215 | 2232 |
|
| 2233 |
TotalValue = WorkRow.Sum(y => CommonMotions.cnvInt(y.Cells[TotalPoint].Value)); // 合計金額 |
|
| 2234 |
ResultValue = WorkRow.Sum(y => CommonMotions.cnvInt(y.Cells[ResultPoint].Value)); // 実績金額 |
|
| 2235 |
|
|
| 2216 | 2236 |
// 月毎クリア |
| 2217 | 2237 |
Array.Clear(MTotal, 0, MTotal.Length); |
| 2218 |
foreach (DataGridViewRow wrkRow in dgv.Rows) |
|
| 2238 |
// 月毎加算 |
|
| 2239 |
int arrayCnt = 0; |
|
| 2240 |
for (int i = (int)GridColumn.Payment; i < dgv.ColumnCount; i++) |
|
| 2219 | 2241 |
{
|
| 2220 |
// 純利益の前までで処理終了
|
|
| 2221 |
if (wrkRow.Index >= BreakLine) break;
|
|
| 2242 |
MTotal[arrayCnt++] = WorkRow.Sum(y => CommonMotions.cnvInt(y.Cells[i].Value));
|
|
| 2243 |
}
|
|
| 2222 | 2244 |
|
| 2223 |
EstimateValue += CommonMotions.cnvInt(wrkRow.Cells[(int)GridColumn.EstimatePrice].Value); // 積算時見積金額 |
|
| 2224 |
ExecValue += CommonMotions.cnvInt(wrkRow.Cells[(int)GridColumn.ExecPrice].Value); // 実行金額 |
|
| 2225 |
PercentValue += CommonMotions.cnvDouble(wrkRow.Cells[(int)GridColumn.Percent].Value); // 構成比率 |
|
| 2226 |
TotalValue += CommonMotions.cnvInt(wrkRow.Cells[TotalPoint].Value); // 合計金額 |
|
| 2227 |
ResultValue += CommonMotions.cnvInt(wrkRow.Cells[ResultPoint].Value); // 実績金額 |
|
| 2228 |
|
|
| 2229 |
// 月毎加算 |
|
| 2230 |
int arrayCnt = 0; |
|
| 2231 |
for (int i = (int)GridColumn.Payment; i < dgv.ColumnCount; i++, arrayCnt++) |
|
| 2232 |
{
|
|
| 2233 |
MTotal[arrayCnt] += CommonMotions.cnvInt(wrkRow.Cells[i].Value); |
|
| 2234 |
} |
|
| 2235 |
} |
|
| 2236 | 2245 |
} |
| 2237 | 2246 |
catch (Exception ex) |
| 2238 | 2247 |
{
|
| ... | ... | |
| 2421 | 2430 |
|
| 2422 | 2431 |
// 月毎合計 |
| 2423 | 2432 |
int arrayCnt = 0; |
| 2424 |
for (int i = (int)GridColumn.Payment; i < dgv.ColumnCount; i++, arrayCnt++)
|
|
| 2433 |
for (int i = (int)GridColumn.Payment; i < dgv.ColumnCount; i++) |
|
| 2425 | 2434 |
{
|
| 2426 |
RowData[i] = MTotal[arrayCnt].ToString("#,0");
|
|
| 2435 |
RowData[i] = MTotal[arrayCnt++].ToString("#,0");
|
|
| 2427 | 2436 |
} |
| 2428 | 2437 |
|
| 2429 | 2438 |
// 合計欄位置取得 |
| ... | ... | |
| 2470 | 2479 |
|
| 2471 | 2480 |
// 月毎合計 |
| 2472 | 2481 |
int arrayCnt = 0; |
| 2473 |
for (int i = (int)GridColumn.Payment; i < dgv.ColumnCount; i++, arrayCnt++)
|
|
| 2482 |
for (int i = (int)GridColumn.Payment; i < dgv.ColumnCount; i++) |
|
| 2474 | 2483 |
{
|
| 2475 |
dgv.Rows[LineCnt].Cells[i].Value = MTotal[arrayCnt].ToString("#,0");
|
|
| 2484 |
dgv.Rows[LineCnt].Cells[i].Value = MTotal[arrayCnt++].ToString("#,0");
|
|
| 2476 | 2485 |
} |
| 2477 | 2486 |
|
| 2478 | 2487 |
// 合計欄位置取得 |
| ... | ... | |
| 2905 | 2914 |
// 支払枠(列)を作成する |
| 2906 | 2915 |
CreatePaymentColumns(DetailList); |
| 2907 | 2916 |
|
| 2917 |
DataGridView dgv = dgvAllDisplay; |
|
| 2908 | 2918 |
// グリッド行削除 |
| 2909 |
dgvAllDisplay.Rows.Clear();
|
|
| 2919 |
dgv.Rows.Clear(); |
|
| 2910 | 2920 |
|
| 2911 |
DataGridView dgv = dgvAllDisplay; |
|
| 2912 | 2921 |
int GridColMax = dgv.ColumnCount; |
| 2913 | 2922 |
int GroupNo = 0; |
| 2914 | 2923 |
int icnt = 1; |
| ... | ... | |
| 4237 | 4246 |
} |
| 4238 | 4247 |
#endregion |
| 4239 | 4248 |
|
| 4249 |
#region 経費を探す |
|
| 4250 |
/// <summary> |
|
| 4251 |
/// 経費を名称から探す |
|
| 4252 |
/// </summary> |
|
| 4253 |
/// <param name="Terget"></param> |
|
| 4254 |
/// <returns></returns> |
|
| 4255 |
private int GetExpenss(string Terget, int ExpensesCode) |
|
| 4256 |
{
|
|
| 4257 |
try |
|
| 4258 |
{
|
|
| 4259 |
int LineRet = 0; |
|
| 4260 |
|
|
| 4261 |
DataGridView dgv = dgvAllDisplay; |
|
| 4262 |
for (int i = 0; i < m_CostsRowCount[(int)CostsRowLine.PurchaseCostsRowLine]; i++) |
|
| 4263 |
{
|
|
| 4264 |
if (CommonMotions.cnvString(dgv.Rows[i].Cells[(int)GridColumn.ItemName].Value).IndexOf(Terget) >= 0 |
|
| 4265 |
|| CommonMotions.cnvInt(dgv.Rows[i].Cells[(int)GridColumn.ComponentCode].Value) == ExpensesCode) |
|
| 4266 |
{
|
|
| 4267 |
LineRet = i; |
|
| 4268 |
break; |
|
| 4269 |
} |
|
| 4270 |
} |
|
| 4271 |
return LineRet; |
|
| 4272 |
} |
|
| 4273 |
catch (System.Exception ex) |
|
| 4274 |
{
|
|
| 4275 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
|
|
| 4276 |
return 0; |
|
| 4277 |
} |
|
| 4278 |
} |
|
| 4279 |
#endregion |
|
| 4280 |
|
|
| 4240 | 4281 |
// ---------- データ登録↓↓ |
| 4241 | 4282 |
#region 工事詳細台帳データ登録 |
| 4242 | 4283 |
/// <summary> |
| ... | ... | |
| 4256 | 4297 |
|
| 4257 | 4298 |
int Colcnt = dgv.ColumnCount - (int)GridColumn.Payment; |
| 4258 | 4299 |
int[] MTotal = new int[Colcnt]; |
| 4259 |
int TotalPoint = dgv.ColumnCount + (int)ColPayTotal.Totals; |
|
| 4260 | 4300 |
|
| 4261 | 4301 |
// 合計値取得 |
| 4262 | 4302 |
GetDetailTotal(ref EstimatePriceValue, ref ExecPriceValue, ref PercentValue, ref TotalValue, ref ResultPriceValue, ref MTotal); |
| ... | ... | |
| 4283 | 4323 |
// 税抜受注決定金額 |
| 4284 | 4324 |
work.OrdersDecisionPrice = CommonMotions.cnvDouble(m_DspLabelCtrl[(int)DspLblCtrlName.OrdersPrice].Text); |
| 4285 | 4325 |
|
| 4286 |
//int Rowcnt1 = GetExpenss("会社", 3);
|
|
| 4287 |
//int Rowcnt2 = GetExpenss("部署", 2);
|
|
| 4288 |
//int Rowcnt3 = GetExpenss("営業", 1);
|
|
| 4326 |
int TotalPoint = dgv.ColumnCount + (int)ColPayTotal.Totals; |
|
| 4327 |
int Rowcnt1 = GetExpenss("会社", 3);
|
|
| 4328 |
int Rowcnt2 = GetExpenss("部署", 2);
|
|
| 4329 |
int Rowcnt3 = GetExpenss("営業", 1);
|
|
| 4289 | 4330 |
//for (int i = (int)GridColumn.Payment; i < TotalPoint; i++) |
| 4290 | 4331 |
//{
|
| 4291 | 4332 |
// // 会社経費合計 |
| ... | ... | |
| 4296 | 4337 |
// work.SalesExpenses += CommonMotions.cnvDouble(dgv.Rows[Rowcnt3].Cells[i].Value); |
| 4297 | 4338 |
//} |
| 4298 | 4339 |
|
| 4340 |
int nGrpNo = (int)GridColumn.GroupCount; |
|
| 4341 |
// 会社経費合計 |
|
| 4342 |
work.CompanyExpenses = dgv.Rows.Cast<DataGridViewRow>().Where(x => CommonMotions.cnvInt(x.Cells[nGrpNo].Value) == (int)DataGroup.Expenses |
|
| 4343 |
&& CommonMotions.cnvInt(x.Cells[(int)GridColumn.ComponentCode].Value) == 3) |
|
| 4344 |
.ToArray() |
|
| 4345 |
.Sum(y => CommonMotions.cnvDouble(y.Cells[TotalPoint].Value)); |
|
| 4346 |
// 部署経費合計 |
|
| 4347 |
work.DepartmentExpenses = dgv.Rows.Cast<DataGridViewRow>().Where(x => CommonMotions.cnvInt(x.Cells[nGrpNo].Value) == (int)DataGroup.Expenses |
|
| 4348 |
&& CommonMotions.cnvInt(x.Cells[(int)GridColumn.ComponentCode].Value) == 2) |
|
| 4349 |
.ToArray() |
|
| 4350 |
.Sum(y => CommonMotions.cnvDouble(y.Cells[TotalPoint].Value)); |
|
| 4351 |
// 営業経費合計 |
|
| 4352 |
work.SalesExpenses = dgv.Rows.Cast<DataGridViewRow>().Where(x => CommonMotions.cnvInt(x.Cells[nGrpNo].Value) == (int)DataGroup.Expenses |
|
| 4353 |
&& CommonMotions.cnvInt(x.Cells[(int)GridColumn.ComponentCode].Value) == 1) |
|
| 4354 |
.ToArray() |
|
| 4355 |
.Sum(y => CommonMotions.cnvDouble(y.Cells[TotalPoint].Value)); |
|
| 4356 |
|
|
| 4299 | 4357 |
// 受注金額積算フラグ |
| 4300 | 4358 |
if (CommonMotions.CheckCreateLedgerData(m_ConstructionBaseInfo.ConstructionStatusFlg, m_ConstructionBaseInfo.ConstructionType)) |
| 4301 | 4359 |
work.IntegrationFlg = (int)CommonDefine.LedgerIntegration.Integration; |
| ... | ... | |
| 4310 | 4368 |
//} |
| 4311 | 4369 |
|
| 4312 | 4370 |
// 担当者給与 |
| 4313 |
int PayrollRow = m_CostsRowCount[(int)CostsRowLine.PayrollRowLine]; |
|
| 4314 |
if (PayrollRow > 0) |
|
| 4315 |
{
|
|
| 4316 |
int GroupNo = 0; |
|
| 4317 |
for (int i = PayrollRow; i < dgv.RowCount; i++) |
|
| 4318 |
{
|
|
| 4319 |
GroupNo = CommonMotions.cnvInt(dgv.Rows[i].Cells[(int)GridColumn.GroupCount].Value); |
|
| 4320 |
if (GroupNo != (int)DataGroup.Payroll) break; |
|
| 4321 |
work.Allowance += CommonMotions.cnvDouble(dgv.Rows[i].Cells[TotalPoint].Value); |
|
| 4322 |
} |
|
| 4323 |
} |
|
| 4371 |
DataGridViewRow[] PayrollRow = dgv.Rows.Cast<DataGridViewRow>().Where(x => CommonMotions.cnvInt(x.Cells[nGrpNo].Value) == (int)DataGroup.Payroll) |
|
| 4372 |
.ToArray(); |
|
| 4373 |
if (PayrollRow.Count() > 0) |
|
| 4374 |
work.Allowance = PayrollRow.Sum(y => CommonMotions.cnvDouble(y.Cells[TotalPoint].Value)); |
|
| 4324 | 4375 |
|
| 4325 | 4376 |
// 副担当者給与 |
| 4326 |
int AssistantRow = m_CostsRowCount[(int)CostsRowLine.AssistantRowLine]; |
|
| 4327 |
double bworkAssistant = 0; |
|
| 4328 |
if (AssistantRow > 0) |
|
| 4329 |
{
|
|
| 4330 |
int GroupNo = 0; |
|
| 4331 |
for (int i = AssistantRow; i < dgv.RowCount; i++) |
|
| 4332 |
{
|
|
| 4333 |
GroupNo = CommonMotions.cnvInt(dgv.Rows[i].Cells[(int)GridColumn.GroupCount].Value); |
|
| 4334 |
if (GroupNo != (int)DataGroup.Assistant) break; |
|
| 4335 |
bworkAssistant += CommonMotions.cnvDouble(dgv.Rows[i].Cells[TotalPoint].Value); |
|
| 4336 |
} |
|
| 4337 |
} |
|
| 4377 |
double wrkAssist = 0; |
|
| 4378 |
DataGridViewRow[] AssistantRow = dgv.Rows.Cast<DataGridViewRow>().Where(x => CommonMotions.cnvInt(x.Cells[nGrpNo].Value) == (int)DataGroup.Assistant) |
|
| 4379 |
.ToArray(); |
|
| 4380 |
if (AssistantRow.Count() > 0) |
|
| 4381 |
wrkAssist = AssistantRow.Sum(y => CommonMotions.cnvDouble(y.Cells[TotalPoint].Value)); |
|
| 4338 | 4382 |
|
| 4339 | 4383 |
// 指導員給与 |
| 4340 |
int InstructorRow = m_CostsRowCount[(int)CostsRowLine.InstructorRowLine]; |
|
| 4341 |
double bworkInstructor = 0; |
|
| 4342 |
if (InstructorRow > 0) |
|
| 4343 |
{
|
|
| 4344 |
int GroupNo = 0; |
|
| 4345 |
for (int i = InstructorRow; i < dgv.RowCount; i++) |
|
| 4346 |
{
|
|
| 4347 |
GroupNo = CommonMotions.cnvInt(dgv.Rows[i].Cells[(int)GridColumn.GroupCount].Value); |
|
| 4348 |
if (GroupNo != (int)DataGroup.Instructor) break; |
|
| 4349 |
bworkInstructor += CommonMotions.cnvDouble(dgv.Rows[i].Cells[TotalPoint].Value); |
|
| 4350 |
} |
|
| 4351 |
} |
|
| 4384 |
double wrkInstr = 0; |
|
| 4385 |
DataGridViewRow[] InstructorRow = dgv.Rows.Cast<DataGridViewRow>().Where(x => CommonMotions.cnvInt(x.Cells[nGrpNo].Value) == (int)DataGroup.Instructor) |
|
| 4386 |
.ToArray(); |
|
| 4387 |
if (InstructorRow.Count() > 0) |
|
| 4388 |
wrkInstr = InstructorRow.Sum(y => CommonMotions.cnvDouble(y.Cells[TotalPoint].Value)); |
|
| 4352 | 4389 |
|
| 4353 | 4390 |
// 総支払額(支払額-(担当者給与+副担当者給与+指導員給与)) |
| 4354 |
double work1 = (work.Allowance + bworkAssistant + bworkInstructor);
|
|
| 4391 |
double work1 = (work.Allowance + wrkAssist + wrkInstr);
|
|
| 4355 | 4392 |
if (work1 < 0) work1 *= -1; |
| 4356 | 4393 |
work.TotalPayment = TotalValue - work1; |
| 4357 | 4394 |
|
| ... | ... | |
| 4363 | 4400 |
BillingValue = CommonMotions.cnvInt(dgv.Rows[BillingLineCnt].Cells[TotalPoint].Value); |
| 4364 | 4401 |
} |
| 4365 | 4402 |
// 粗利(請求金額-(支払額-(担当者給与+副担当者給与+指導員給与))) |
| 4366 |
double work2 = (TotalValue - (work.Allowance + bworkAssistant + bworkInstructor));
|
|
| 4403 |
double work2 = (TotalValue - (work.Allowance + wrkAssist + wrkInstr));
|
|
| 4367 | 4404 |
if (work2 < 0) work2 *= -1; |
| 4368 | 4405 |
work.GrossProfit = BillingValue - work2; |
| 4369 | 4406 |
|
| ... | ... | |
| 5464 | 5501 |
break; |
| 5465 | 5502 |
} |
| 5466 | 5503 |
} |
| 5504 |
DetailRec.CompanyType = (int)CommonDefine.CodeDataType.Person; // コードタイプ(担当者) |
|
| 5467 | 5505 |
|
| 5468 | 5506 |
// 設定無は処理しない |
| 5469 | 5507 |
if (DetailRec.CompanyCode == 0) return; |
| ... | ... | |
| 5476 | 5514 |
if (!PersonDB.SelectAction(strSQL, ref PersonRec)) return; |
| 5477 | 5515 |
|
| 5478 | 5516 |
DetailRec.FirstString = string.Format("{0}【{1}氏】", s_GroupTitle[GroupNo], PersonRec.SealPrintName);
|
| 5517 |
DetailRec.ComponentCode = PersonRec.DepartmentCode; |
|
| 5518 |
|
|
| 5479 | 5519 |
} |
| 5480 | 5520 |
catch (Exception ex) |
| 5481 | 5521 |
{
|
| ... | ... | |
| 8915 | 8955 |
|
| 8916 | 8956 |
// 再計算処理 |
| 8917 | 8957 |
if (!frm.RecalculateLedger) break; |
| 8958 |
|
|
| 8959 |
// 画面を閉じる |
|
| 8960 |
frm.Close(); |
|
| 8918 | 8961 |
} |
| 8919 |
|
|
| 8920 |
// 画面を閉じる |
|
| 8921 |
frm.Close(); |
|
| 8922 | 8962 |
} |
| 8923 | 8963 |
catch (Exception ex) |
| 8924 | 8964 |
{
|
| branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedgerList/CreateLedgerSQL.cs | ||
|---|---|---|
| 1 |
using System; |
|
| 2 |
using System.Collections.Generic; |
|
| 3 |
using System.ComponentModel; |
|
| 4 |
using System.Data; |
|
| 5 |
using System.Drawing; |
|
| 6 |
using System.Linq; |
|
| 7 |
using System.Text; |
|
| 8 |
using System.Windows.Forms; |
|
| 9 |
using System.Collections; |
|
| 10 |
using System.Diagnostics; |
|
| 11 |
using System.Threading; |
|
| 12 |
|
|
| 13 |
using log4net; |
|
| 14 |
using log4net.Appender; |
|
| 15 |
using log4net.Repository.Hierarchy; |
|
| 16 |
|
|
| 17 |
using ProcessManagement.Common; |
|
| 18 |
using ProcessManagement.DB.IOAccess; |
|
| 19 |
using ProcessManagement.DataModel; |
|
| 20 |
using ProcessManagement.DB.Core; |
|
| 21 |
using ProcessManagement.Forms.CustomControls; |
|
| 22 |
using ProcessManagement.Forms.ControlsAction; |
|
| 23 |
using ProcessManagement.Forms.SubForms; |
|
| 24 |
//*---------------------------- 台帳データ取得SQL作成クラス -------------------* |
|
| 25 |
// 2017/08/21 Ver1.0.0.0 Create Source |
|
| 26 |
// |
|
| 27 |
// |
|
| 28 |
// |
|
| 29 |
//*----------------------------------------------------------------------------* |
|
| 30 |
|
|
| 31 |
namespace ProcessManagement.Forms.DataEntry |
|
| 32 |
{
|
|
| 33 |
/// <summary> |
|
| 34 |
/// 台帳データ取得SQL作成クラス |
|
| 35 |
/// </summary> |
|
| 36 |
public static class CreateLedgerSQL |
|
| 37 |
{
|
|
| 38 |
#region ログ定義 |
|
| 39 |
/// <summary> |
|
| 40 |
/// log4netログを使用する |
|
| 41 |
/// </summary> |
|
| 42 |
private static readonly ILog logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
|
| 43 |
#endregion |
|
| 44 |
|
|
| 45 |
#region 期間データ取得順 |
|
| 46 |
/// <summary> |
|
| 47 |
/// 期間データ取得順 |
|
| 48 |
/// </summary> |
|
| 49 |
public enum GetPersonTerm |
|
| 50 |
{
|
|
| 51 |
DepartmentCode = 0, |
|
| 52 |
/// <summary> |
|
| 53 |
/// 担当者コード |
|
| 54 |
/// </summary> |
|
| 55 |
PersonCode, |
|
| 56 |
/// <summary> |
|
| 57 |
/// 担当者名 |
|
| 58 |
/// </summary> |
|
| 59 |
Personname, |
|
| 60 |
/// <summary> |
|
| 61 |
/// 表示順 |
|
| 62 |
/// </summary> |
|
| 63 |
Displayorder, |
|
| 64 |
/// <summary> |
|
| 65 |
/// 月額給与 |
|
| 66 |
/// </summary> |
|
| 67 |
MonthlySalary, |
|
| 68 |
/// <summary> |
|
| 69 |
/// 契約工期開始 |
|
| 70 |
/// </summary> |
|
| 71 |
StartDate, |
|
| 72 |
/// <summary> |
|
| 73 |
/// 契約工期終了 |
|
| 74 |
/// </summary> |
|
| 75 |
CompDate, |
|
| 76 |
/// <summary> |
|
| 77 |
/// 雇用開始日付 |
|
| 78 |
/// </summary> |
|
| 79 |
HireStartDays, |
|
| 80 |
/// <summary> |
|
| 81 |
/// 雇用終了日付 |
|
| 82 |
/// </summary> |
|
| 83 |
HireCompDays, |
|
| 84 |
/// <summary> |
|
| 85 |
/// 来季契約工期開始 |
|
| 86 |
/// </summary> |
|
| 87 |
NextStartDate, |
|
| 88 |
/// <summary> |
|
| 89 |
/// 来季契約工期終了 |
|
| 90 |
/// </summary> |
|
| 91 |
NextCompDate, |
|
| 92 |
} |
|
| 93 |
#endregion |
|
| 94 |
|
|
| 95 |
#region 部署内の担当者コードを一覧で返す |
|
| 96 |
/// <summary> |
|
| 97 |
/// 部署内の担当者コードを一覧で返す |
|
| 98 |
/// </summary> |
|
| 99 |
public static int GetPersonInDepartment(int BusinessPeriod, int DepartmentCode, int PersonCode, ref ArrayList TargetList) |
|
| 100 |
{
|
|
| 101 |
IOMPersonInCharge PersonDB = new IOMPersonInCharge(); |
|
| 102 |
try |
|
| 103 |
{
|
|
| 104 |
int NotOrder = CommonDefine.ProjectsStatus.First(x => x.Value.Equals("非 受 注")).Key;
|
|
| 105 |
|
|
| 106 |
StringBuilder strSQL = new StringBuilder(); |
|
| 107 |
|
|
| 108 |
DateTime dtDefaultStart = CommonMotions.GetOpeningEndDate(BusinessPeriod, true); |
|
| 109 |
DateTime dtDefaultEnd = CommonMotions.GetOpeningEndDate(BusinessPeriod, false); |
|
| 110 |
|
|
| 111 |
int nPrevYear = (BusinessPeriod - 1); |
|
| 112 |
if (nPrevYear < 0) nPrevYear = 0; |
|
| 113 |
DateTime dtPrevStart = CommonMotions.GetOpeningEndDate(nPrevYear, true); |
|
| 114 |
DateTime dtNextEnd = CommonMotions.GetOpeningEndDate((BusinessPeriod + 1), false); |
|
| 115 |
|
|
| 116 |
strSQL.Append("Select");
|
|
| 117 |
strSQL.Append(" DepHis.DepartmentCode");
|
|
| 118 |
strSQL.Append(", Person.PersonCode");
|
|
| 119 |
strSQL.Append(", Person.PersonName");
|
|
| 120 |
strSQL.Append(", Person.DisplayOrder");
|
|
| 121 |
strSQL.Append(", Person.MonthlySalary");
|
|
| 122 |
strSQL.Append(", Detail.SDate AS StartDate");
|
|
| 123 |
strSQL.Append(", Detail.EDate AS CompDate");
|
|
| 124 |
strSQL.Append(", Person.StartDate AS HireStartDays");
|
|
| 125 |
strSQL.Append(", Person.EndDate AS HireCompDays");
|
|
| 126 |
strSQL.Append(", NextDetail.SDate AS NextStart");
|
|
| 127 |
strSQL.Append(", NextDetail.EDate AS NextEnd");
|
|
| 128 |
strSQL.Append(" From");
|
|
| 129 |
strSQL.Append(" personinchargemaster As Person");
|
|
| 130 |
|
|
| 131 |
strSQL.Append(" Left Join chgchargedep As DepHis");
|
|
| 132 |
strSQL.Append(" ON DepHis.PersonCode = Person.PersonCode");
|
|
| 133 |
strSQL.AppendFormat(" AND ((DATE(DepHis.STARTDATE) <= DATE('{0}'))", dtDefaultEnd.ToShortDateString());
|
|
| 134 |
strSQL.AppendFormat(" AND (DATE('{0}') <= DATE(DepHis.CompDate)", dtDefaultStart.ToShortDateString());
|
|
| 135 |
strSQL.AppendFormat(" OR DATE('{0}') = DATE(DepHis.CompDate)))", DateTime.MinValue.ToShortDateString());
|
|
| 136 |
|
|
| 137 |
// 今期の開始終了(工事開始年月日が先期開始年月日以降を検索する) |
|
| 138 |
strSQL.Append(" Left Join");
|
|
| 139 |
strSQL.Append(" (Select LDetail.CompanyCode As PersonCode");
|
|
| 140 |
strSQL.Append(" , MIN(Ledger.ConstructionStart) As SDate");
|
|
| 141 |
strSQL.Append(" , MAX(Ledger.ConstructionEnd) As EDate");
|
|
| 142 |
strSQL.Append(" From constructionledgerdetail As LDetail");
|
|
| 143 |
strSQL.Append(" Inner Join constructionledger As Ledger");
|
|
| 144 |
strSQL.Append(" On Ledger.ConstructionCode = LDetail.ConstructionCode");
|
|
| 145 |
strSQL.AppendFormat(" And DATE('{0}') <= DATE(Ledger.Constructionstart)", dtPrevStart.ToShortDateString());
|
|
| 146 |
strSQL.Append(" Inner Join constructionbaseinfo As Base");
|
|
| 147 |
strSQL.Append(" On Base.ConstructionCode = LDetail.ConstructionCode");
|
|
| 148 |
strSQL.AppendFormat(" And Base.ConstructionStatusFlg <> {0}", NotOrder);
|
|
| 149 |
strSQL.AppendFormat(" And Base.ConstructionPeriod = {0}", BusinessPeriod);
|
|
| 150 |
strSQL.AppendFormat(" Where LDetail.GroupCount IN ({0}, {1}, {2})"
|
|
| 151 |
, (int)FrmConstructionLedger.DataGroup.Instructor |
|
| 152 |
, (int)FrmConstructionLedger.DataGroup.Assistant |
|
| 153 |
, (int)FrmConstructionLedger.DataGroup.Payroll); |
|
| 154 |
strSQL.Append(" And LDetail.CompanyCode <> 0");
|
|
| 155 |
strSQL.Append(" Group By PersonCode");
|
|
| 156 |
strSQL.Append(" ) As Detail");
|
|
| 157 |
strSQL.Append(" ON Detail.PersonCode = Person.PersonCode");
|
|
| 158 |
|
|
| 159 |
// 来季の開始終了(工事開始年月日が今期開始年月日以降を検索する) |
|
| 160 |
strSQL.Append(" Left Join");
|
|
| 161 |
strSQL.Append(" (Select LDetail2.CompanyCode As PersonCode");
|
|
| 162 |
strSQL.Append(" , MIN(Ledger2.ConstructionStart) As SDate");
|
|
| 163 |
strSQL.Append(" , MAX(Ledger2.ConstructionEnd) As EDate");
|
|
| 164 |
strSQL.Append(" From constructionLedgerdetail As LDetail2");
|
|
| 165 |
strSQL.Append(" Inner Join constructionLedger As Ledger2");
|
|
| 166 |
strSQL.Append(" On Ledger2.ConstructionCode = LDetail2.ConstructionCode");
|
|
| 167 |
strSQL.AppendFormat(" And DATE('{0}') <= DATE(Ledger2.Constructionstart)", dtDefaultStart.ToShortDateString());
|
|
| 168 |
strSQL.Append(" Inner Join constructionbaseinfo As Base");
|
|
| 169 |
strSQL.Append(" On Base.ConstructionCode = LDetail2.ConstructionCode");
|
|
| 170 |
strSQL.AppendFormat(" And Base.ConstructionStatusFlg <> {0}", NotOrder);
|
|
| 171 |
strSQL.AppendFormat(" And Base.ConstructionPeriod = {0}", BusinessPeriod + 1);
|
|
| 172 |
strSQL.AppendFormat(" Where LDetail2.GroupCount IN ({0}, {1}, {2})"
|
|
| 173 |
, (int)FrmConstructionLedger.DataGroup.Instructor |
|
| 174 |
, (int)FrmConstructionLedger.DataGroup.Assistant |
|
| 175 |
, (int)FrmConstructionLedger.DataGroup.Payroll); |
|
| 176 |
strSQL.Append(" And LDetail2.CompanyCode <> 0");
|
|
| 177 |
strSQL.Append(" Group By PersonCode");
|
|
| 178 |
strSQL.Append(" ) As NextDetail");
|
|
| 179 |
strSQL.Append(" ON NextDetail.PersonCode = Person.PersonCode");
|
|
| 180 |
|
|
| 181 |
strSQL.AppendFormat(" Where Person.LEDGERFLG = {0}", (int)PersonInChargeMaster.LedgerDivNoDef.CalcTarget);
|
|
| 182 |
|
|
| 183 |
if (CommonMotions.LoginUserData.PersonCode != CommonDefine.AdminCode) |
|
| 184 |
{
|
|
| 185 |
strSQL.Append(" AND Person.DEPARTMENTCODE IN (select PDep.DepartmentCode from PersonDepartmentMaster AS PDep");
|
|
| 186 |
strSQL.AppendFormat(" WHERE PDep.PersonCode = {0})", CommonMotions.LoginUserData.PersonCode);
|
|
| 187 |
} |
|
| 188 |
|
|
| 189 |
// 工事台帳データの部署だけが対象 |
|
| 190 |
if (DepartmentCode > 0) |
|
| 191 |
{
|
|
| 192 |
// 部署コード選択時は部署を検索条件へ入れる |
|
| 193 |
strSQL.AppendFormat(" AND DepHis.DEPARTMENTCODE = {0}", DepartmentCode);
|
|
| 194 |
} |
|
| 195 |
if (PersonCode != 0) strSQL.AppendFormat(" AND Person.PERSONCODE = {0}", PersonCode);
|
|
| 196 |
|
|
| 197 |
strSQL.AppendFormat(" AND ((DATE(Person.STARTDATE) <= DATE('{0}'))", dtDefaultEnd.ToShortDateString());
|
|
| 198 |
strSQL.AppendFormat(" AND (DATE('{0}') <= DATE(Person.ENDDATE)", dtDefaultStart.ToShortDateString());
|
|
| 199 |
strSQL.AppendFormat(" OR DATE('{0}') = DATE(Person.ENDDATE)))", DateTime.MinValue.ToShortDateString());
|
|
| 200 |
|
|
| 201 |
strSQL.AppendFormat(" ORDER BY DepHis.DepartmentCode, Person.EmployeeClassFlg, Person.DISPLAYORDER");
|
|
| 202 |
|
|
| 203 |
if (!PersonDB.ExecuteReader(strSQL.ToString(), ref TargetList)) return 0; |
|
| 204 |
|
|
| 205 |
return TargetList.Count; |
|
| 206 |
} |
|
| 207 |
catch (Exception ex) |
|
| 208 |
{
|
|
| 209 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
|
|
| 210 |
return 0; |
|
| 211 |
} |
|
| 212 |
finally |
|
| 213 |
{
|
|
| 214 |
PersonDB.close(); PersonDB = null; |
|
| 215 |
} |
|
| 216 |
} |
|
| 217 |
#endregion |
|
| 218 |
|
|
| 219 |
#region 経過給与を取得する |
|
| 220 |
/// <summary> |
|
| 221 |
/// 経過給与を取得する |
|
| 222 |
/// </summary> |
|
| 223 |
public static void GetElapsedSalary(IOMPersonInCharge SalaryDB, int TargetNum, ArrayList TargetList, ref List<SalaryClass> ArrarySalary) |
|
| 224 |
{
|
|
| 225 |
try |
|
| 226 |
{
|
|
| 227 |
// デフォルト開始・終了を取得する |
|
| 228 |
DateTime dtDefaultStart = CommonMotions.GetOpeningEndDate(TargetNum, true); |
|
| 229 |
DateTime dtDefaultEnd = CommonMotions.GetOpeningEndDate(TargetNum, false); |
|
| 230 |
DateTime stDate = DateTime.Today; |
|
| 231 |
DateTime edDate = DateTime.Today; |
|
| 232 |
|
|
| 233 |
// 給与を集計する |
|
| 234 |
foreach (object[] ObjRec in TargetList) |
|
| 235 |
{
|
|
| 236 |
// 開始・終了日が無い場合はデフォルトの期首・期末を使用する |
|
| 237 |
stDate = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.StartDate]); |
|
| 238 |
edDate = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.CompDate]); |
|
| 239 |
CalcStartCompDate(TargetNum, |
|
| 240 |
dtDefaultStart, dtDefaultEnd, |
|
| 241 |
CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.HireStartDays]), |
|
| 242 |
CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.HireCompDays]), |
|
| 243 |
CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.NextStartDate]), |
|
| 244 |
CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.NextCompDate]), |
|
| 245 |
ref stDate, ref edDate); |
|
| 246 |
|
|
| 247 |
int nDepartmentCode = CommonMotions.cnvInt(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.DepartmentCode]); |
|
| 248 |
int nPersonCode = CommonMotions.cnvInt(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.PersonCode]); |
|
| 249 |
|
|
| 250 |
// 零れた給与日数取得 |
|
| 251 |
int TargetY = TargetNum; |
|
| 252 |
int NextDiffDay = 0; |
|
| 253 |
int PrevDiffDay = 0; |
|
| 254 |
CommonMotions.CalcSpilledSalary(SalaryDB, TargetY, stDate, edDate, nPersonCode, ref NextDiffDay, ref PrevDiffDay); |
|
| 255 |
// 今期終了日変更 |
|
| 256 |
DateTime wrkDate = edDate.AddDays(NextDiffDay); |
|
| 257 |
if (dtDefaultEnd.Date < wrkDate.Date) wrkDate = dtDefaultEnd; |
|
| 258 |
ObjRec[(int)CreateLedgerSQL.GetPersonTerm.CompDate] = wrkDate; |
|
| 259 |
// 今期開始日変更 |
|
| 260 |
wrkDate = stDate.AddDays(PrevDiffDay); |
|
| 261 |
if (dtDefaultEnd.Date < wrkDate.Date) wrkDate = dtDefaultEnd; |
|
| 262 |
ObjRec[(int)CreateLedgerSQL.GetPersonTerm.StartDate] = wrkDate; |
|
| 263 |
|
|
| 264 |
stDate = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.StartDate]); |
|
| 265 |
edDate = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.CompDate]); |
|
| 266 |
|
|
| 267 |
// 給与累積取得 |
|
| 268 |
int workSalary = CommonMotions.CalcElapsedSalary(SalaryDB, stDate, edDate, nPersonCode); |
|
| 269 |
|
|
| 270 |
// 配列セット |
|
| 271 |
ArrarySalary.Add(new SalaryClass(nDepartmentCode, nPersonCode, workSalary, stDate, edDate)); |
|
| 272 |
} |
|
| 273 |
} |
|
| 274 |
catch (Exception ex) |
|
| 275 |
{
|
|
| 276 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
|
|
| 277 |
} |
|
| 278 |
} |
|
| 279 |
#endregion |
|
| 280 |
|
|
| 281 |
#region 計算開始・終了日のチェック入れ替え |
|
| 282 |
/// <summary> |
|
| 283 |
/// 計算開始・終了日のチェック入れ替え |
|
| 284 |
/// </summary> |
|
| 285 |
public static void CalcStartCompDate(int BusinessPeriod, |
|
| 286 |
DateTime dtDefaultStart, DateTime dtDefaultEnd, |
|
| 287 |
DateTime HireStartDate, DateTime HireCompDate, |
|
| 288 |
DateTime NextStartDate, DateTime NextCompDate, |
|
| 289 |
ref DateTime StartDate, ref DateTime CompDate) |
|
| 290 |
{
|
|
| 291 |
try |
|
| 292 |
{
|
|
| 293 |
// ----- 計算開始日セット |
|
| 294 |
if (StartDate == DateTime.MinValue) |
|
| 295 |
{
|
|
| 296 |
StartDate = dtDefaultStart; |
|
| 297 |
} |
|
| 298 |
else if (dtDefaultStart <= HireStartDate && HireStartDate <= dtDefaultEnd) |
|
| 299 |
{
|
|
| 300 |
StartDate = HireStartDate; |
|
| 301 |
} |
|
| 302 |
else if (dtDefaultStart < StartDate) |
|
| 303 |
{
|
|
| 304 |
StartDate = dtDefaultStart; |
|
| 305 |
} |
|
| 306 |
// 入社日が期内ならば開始を入社日にする |
|
| 307 |
if (dtDefaultStart < HireStartDate && HireStartDate < dtDefaultEnd) StartDate = HireStartDate; |
|
| 308 |
|
|
| 309 |
// ----- 計算終了日セット |
|
| 310 |
// Defaultは期末 |
|
| 311 |
CompDate = dtDefaultEnd; |
|
| 312 |
|
|
| 313 |
// 退社日が期内ならば終了を退社日にする |
|
| 314 |
if (dtDefaultStart < HireCompDate && HireCompDate < dtDefaultEnd) CompDate = HireCompDate; |
|
| 315 |
|
|
| 316 |
// 来季の開始があって期末日より小さい場合は置き換える |
|
| 317 |
if (NextStartDate != DateTime.MinValue) |
|
| 318 |
{
|
|
| 319 |
if (StartDate < NextStartDate && NextStartDate < CompDate) CompDate = NextStartDate.AddDays(-1); |
|
| 320 |
} |
|
| 321 |
} |
|
| 322 |
catch (Exception ex) |
|
| 323 |
{
|
|
| 324 |
logger.ErrorFormat("システムエラー:{0}", ex.Message);
|
|
| 325 |
} |
|
| 326 |
} |
|
| 327 |
#endregion |
|
| 328 |
|
|
| 329 |
#region 工事詳細台帳より振分給与金額を取得する |
|
| 330 |
/// <summary> |
|
| 331 |
/// 工事詳細台帳より振分給与金額を取得する |
|
| 332 |
/// </summary> |
|
| 333 |
public static void ProfitGeneral(IOConstructionLedger LedgerDB, int ConstructionPeriod, |
|
| 334 |
int DepartmentCode, int PersonCode, ref int OnSalary, |
|
| 335 |
bool bExec = true) |
|
| 336 |
{
|
|
| 337 |
try |
|
| 338 |
{
|
|
| 339 |
// 部署コード取得 |
|
| 340 |
int NotOrder = CommonDefine.ProjectsStatus.First(x => x.Value.Equals("非 受 注")).Key;
|
|
| 341 |
// 工事予算と詳細台帳のグループ番号差を取得する |
|
| 342 |
int nGroupDiff = (int)FrmConstructionBudget.DataGroup.InstructorCosts - (int)FrmConstructionLedger.DataGroup.Instructor; |
|
| 343 |
|
|
| 344 |
// 振分給与金額取得 |
|
| 345 |
StringBuilder strSQL = new StringBuilder(); |
|
| 346 |
strSQL.Append("SELECT");
|
|
| 347 |
if (bExec) |
|
| 348 |
strSQL.Append(" SUM(C2.PAYMENTAMOUNT)");
|
|
| 349 |
else |
|
| 350 |
strSQL.Append(" SUM(C3.PAYMENTAMOUNT)");
|
|
| 351 |
|
|
| 352 |
strSQL.Append(" FROM");
|
|
| 353 |
strSQL.Append(" CONSTRUCTIONLEDGER P");
|
|
| 354 |
strSQL.Append(", CONSTRUCTIONBASEINFO B");
|
|
| 355 |
strSQL.Append(", CONSTRUCTIONLEDGERDETAIL C");
|
|
| 356 |
|
|
| 357 |
if (bExec) |
|
| 358 |
{
|
|
| 359 |
strSQL.Append(" LEFT JOIN");
|
|
| 360 |
strSQL.Append(" (Select");
|
|
| 361 |
strSQL.Append(" CC2.ConstructionCode AS ConstructionCode");
|
|
| 362 |
strSQL.Append(", CC2.GroupCount AS GroupCount");
|
|
| 363 |
strSQL.Append(", ifnull(SUM(CC2.PaymentAmount), 0) AS PaymentAmount");
|
|
| 364 |
strSQL.Append(" From constructionledgerexcute AS CC2");
|
|
| 365 |
strSQL.Append(" Group By CC2.ConstructionCode, CC2.GroupCount");
|
|
| 366 |
strSQL.Append(" ) AS C2");
|
|
| 367 |
strSQL.Append(" ON C2.ConstructionCode = C.ConstructionCode");
|
|
| 368 |
strSQL.Append(" And C2.GroupCount = C.GroupCount");
|
|
| 369 |
} |
|
| 370 |
else |
|
| 371 |
{
|
|
| 372 |
strSQL.Append(" LEFT JOIN");
|
|
| 373 |
strSQL.Append(" (Select");
|
|
| 374 |
strSQL.Append(" CC3.ConstructionCode AS ConstructionCode");
|
|
| 375 |
strSQL.Append(", CC3.GroupCount AS GroupCount");
|
|
| 376 |
strSQL.Append(", ifnull(SUM(CC3.OrderDesiredAmount), 0) AS PaymentAmount");
|
|
| 377 |
strSQL.Append(" From constructionbudgetdetail AS CC3");
|
|
| 378 |
strSQL.Append(" Group By CC3.ConstructionCode, CC3.GroupCount");
|
|
| 379 |
strSQL.Append(") AS C3");
|
|
| 380 |
strSQL.Append(" ON ROUND((C3.ConstructionCode / 100), 0) = ROUND((C.ConstructionCode / 100), 0)");
|
|
| 381 |
strSQL.AppendFormat(" And C3.GroupCount = (C.GroupCount + {0})", nGroupDiff);
|
|
| 382 |
} |
|
| 383 |
|
|
| 384 |
// 振分無では無い |
|
| 385 |
strSQL.AppendFormat(" WHERE B.CONSTRUCTIONPERIOD = {0}", ConstructionPeriod);
|
|
| 386 |
strSQL.AppendFormat(" AND B.CONSTRUCTIONSTATUSFLG != {0}", NotOrder);
|
|
| 387 |
strSQL.Append(" AND B.CONSTRUCTIONCODE = P.CONSTRUCTIONCODE");
|
|
| 388 |
|
|
| 389 |
if (DepartmentCode != 0) strSQL.AppendFormat(" AND B.ConstrDepCode = {0}", DepartmentCode);
|
|
| 390 |
if (PersonCode != 0) strSQL.AppendFormat(" AND B.ConstructionPersonCode = {0}", PersonCode);
|
|
| 391 |
|
|
| 392 |
strSQL.Append(" AND C.CONSTRUCTIONCODE = P.CONSTRUCTIONCODE");
|
|
| 393 |
strSQL.AppendFormat(" AND C.GROUPCOUNT = {0}", (int)FrmConstructionLedger.DataGroup.Payroll);
|
|
| 394 |
strSQL.Append(" AND C.CompanyCode = B.ConstructionPersonCode");
|
|
| 395 |
|
|
| 396 |
if (CommonMotions.LoginUserData.PersonCode != CommonDefine.AdminCode) |
|
| 397 |
{
|
|
| 398 |
strSQL.Append(" AND B.ConstrDepCode IN (select PDep.DepartmentCode from PersonDepartmentMaster AS PDep");
|
|
| 399 |
strSQL.AppendFormat(" WHERE PDep.PersonCode = {0})", CommonMotions.LoginUserData.PersonCode);
|
|
| 400 |
} |
|
| 401 |
|
|
| 402 |
ArrayList arList = new ArrayList(); |
|
| 403 |
if (!LedgerDB.ExecuteReader(strSQL.ToString(), ref arList)) return; |
|
| 404 |
object[] objSalary = (object[])arList[0]; |
|
| 405 |
OnSalary = CommonMotions.cnvInt(objSalary[0]); |
|
| 406 |
} |
|
| 407 |
catch (Exception ex) |
|
| 408 |
{
|
|
| 409 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
|
|
| 410 |
} |
|
| 411 |
} |
|
| 412 |
#endregion |
|
| 413 |
|
|
| 414 |
#region 担当者毎割当無費目毎の経費を取得する |
|
| 415 |
/// <summary> |
|
| 416 |
/// 担当者毎割当無費目毎の経費を取得する |
|
| 417 |
/// </summary> |
|
| 418 |
public static void GetPersonExpensesCostValue(IOCostDataOfPerson CostDB, |
|
| 419 |
int DepartmentCode, int PersonCode, |
|
| 420 |
DateTime dtStart, DateTime dtEnd, |
|
| 421 |
ref int[] CostValue) |
|
| 422 |
{
|
|
| 423 |
try |
|
| 424 |
{
|
|
| 425 |
// 担当者毎経費データよりどこの工事にも所属していない経費を取得する |
|
| 426 |
StringBuilder strSQL = new StringBuilder(); |
|
| 427 |
|
|
| 428 |
strSQL.Append(" SELECT");
|
|
| 429 |
strSQL.Append(" PERSONCODE");
|
|
| 430 |
strSQL.Append(", B.DATATYPE AS DATATYPE");
|
|
| 431 |
strSQL.Append(", SUM(B.ENTRYPRICE) AS SUMPRICE");
|
|
| 432 |
strSQL.Append(" FROM");
|
|
| 433 |
strSQL.Append(" COSTDATAOFPERSON AS B");
|
|
| 434 |
strSQL.Append(" WHERE");
|
|
| 435 |
|
|
| 436 |
strSQL.Append(" B.PERSONCODE IN (SELECT BPerson.PERSONCODE FROM personinchargemaster As BPerson");
|
|
| 437 |
|
|
| 438 |
StringBuilder strSub = new StringBuilder(); |
|
| 439 |
if (DepartmentCode != 0) strSub.AppendFormat(" BPerson.DepartmentCode = {0}", DepartmentCode);
|
|
| 440 |
if (PersonCode != 0) |
|
| 441 |
{
|
|
| 442 |
if (strSub.ToString().Length > 0) strSub.Append(" And");
|
|
| 443 |
strSub.AppendFormat(" BPerson.PersonCode = {0}", PersonCode);
|
|
| 444 |
} |
|
| 445 |
if (strSub.ToString().Length > 0) |
|
| 446 |
{
|
|
| 447 |
strSQL.Append(" Where");
|
|
| 448 |
strSQL.Append(strSub.ToString()); |
|
| 449 |
} |
|
| 450 |
strSQL.Append(")");
|
|
| 451 |
|
|
| 452 |
strSQL.AppendFormat(" AND (DATE('{0}') <= DATE(B.ACTIONDATE)", dtStart.ToShortDateString());
|
|
| 453 |
strSQL.AppendFormat(" AND DATE(B.ACTIONDATE) <= DATE('{0}'))", dtEnd.ToShortDateString());
|
|
| 454 |
strSQL.Append(" AND B.CONSTRUCTIONCODE = 0");
|
|
| 455 |
strSQL.Append(" GROUP BY B.DATATYPE");
|
|
| 456 |
|
|
| 457 |
ArrayList arList = new ArrayList(); |
|
| 458 |
if (!CostDB.ExecuteReader(strSQL.ToString(), ref arList)) return; |
|
| 459 |
|
|
| 460 |
// 取得結果を振り分ける |
|
| 461 |
foreach (object[] wrkobj in arList) |
|
| 462 |
{
|
|
| 463 |
for (int i = 1; i < CostDataOfPerson.DataNoStrArrary.Length; i++) |
|
| 464 |
{
|
|
| 465 |
if (CommonMotions.cnvInt(wrkobj[1]) == i) |
|
| 466 |
{
|
|
| 467 |
CostValue[i] += CommonMotions.cnvInt(wrkobj[2]); |
|
| 468 |
break; |
|
| 469 |
} |
|
| 470 |
} |
|
| 471 |
} |
|
| 472 |
} |
|
| 473 |
catch (Exception ex) |
|
| 474 |
{
|
|
| 475 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
|
|
| 476 |
} |
|
| 477 |
} |
|
| 478 |
#endregion |
|
| 479 |
|
|
| 480 |
#region 担当者毎割当無費目毎の経費を取得する(一括バージョン) |
|
| 481 |
/// <summary> |
|
| 482 |
/// 担当者毎割当無費目毎の経費を取得する(一括バージョン) |
|
| 483 |
/// </summary> |
|
| 484 |
public static void GetPersonExpensesCostValue(IOCostDataOfPerson CostDB, |
|
| 485 |
int nNowYear, |
|
| 486 |
List<SalaryClass> ArrarySalary, |
|
| 487 |
ref List<PersonExpensesCost> CostValue) |
|
| 488 |
{
|
|
| 489 |
try |
|
| 490 |
{
|
|
| 491 |
// デフォルト開始・終了を取得する |
|
| 492 |
DateTime dtDefaultStart = CommonMotions.GetOpeningEndDate(nNowYear, true); |
|
| 493 |
DateTime dtDefaultEnd = CommonMotions.GetOpeningEndDate(nNowYear, false); |
|
| 494 |
|
|
| 495 |
// 担当者毎経費データよりどこの工事にも所属していない経費を取得する |
|
| 496 |
StringBuilder strSQL = new StringBuilder(); |
|
| 497 |
|
|
| 498 |
strSQL.Append(" SELECT");
|
|
| 499 |
strSQL.Append(" PERSONCODE");
|
|
| 500 |
strSQL.Append(", B.DATATYPE AS DATATYPE");
|
|
| 501 |
strSQL.Append(", SUM(B.ENTRYPRICE) AS SUMPRICE");
|
|
| 502 |
strSQL.Append(" FROM");
|
|
| 503 |
strSQL.Append(" COSTDATAOFPERSON AS B");
|
|
| 504 |
strSQL.Append(" WHERE");
|
|
| 505 |
|
|
| 506 |
int[] GetCostVal = new int[CostDataOfPerson.DataNoStrArrary.Length]; |
|
| 507 |
ArrayList arList = new ArrayList(); |
|
| 508 |
StringBuilder strWhere = new StringBuilder(); |
|
| 509 |
StringBuilder strExec = new StringBuilder(); |
|
| 510 |
foreach (SalaryClass CurData in ArrarySalary) |
|
| 511 |
{
|
|
| 512 |
strWhere.Clear(); |
|
| 513 |
strExec.Clear(); |
|
| 514 |
strWhere.AppendFormat(" B.PERSONCODE = {0}", CurData.PersonCode);
|
|
| 515 |
|
|
| 516 |
strWhere.AppendFormat(" AND (DATE('{0}') <= DATE(B.ACTIONDATE)", dtDefaultStart.ToShortDateString());
|
|
| 517 |
strWhere.AppendFormat(" AND DATE(B.ACTIONDATE) <= DATE('{0}'))", dtDefaultEnd.ToShortDateString());
|
|
| 518 |
strWhere.Append(" AND B.CONSTRUCTIONCODE = 0");
|
|
| 519 |
strWhere.Append(" GROUP BY B.DATATYPE");
|
|
| 520 |
|
|
| 521 |
strExec.Append(strSQL.ToString()); |
|
| 522 |
strExec.Append(strWhere.ToString()); |
|
| 523 |
|
|
| 524 |
arList.Clear(); |
|
| 525 |
if (!CostDB.ExecuteReader(strExec.ToString(), ref arList)) continue; |
|
| 526 |
|
|
| 527 |
Array.Clear(GetCostVal, 0, GetCostVal.Length); |
|
| 528 |
// 取得結果を振り分ける |
|
| 529 |
foreach (object[] wrkobj in arList) |
|
| 530 |
{
|
|
| 531 |
for (int i = 1; i < CostDataOfPerson.DataNoStrArrary.Length; i++) |
|
| 532 |
{
|
|
| 533 |
if (CommonMotions.cnvInt(wrkobj[1]) == i) |
|
| 534 |
{
|
|
| 535 |
GetCostVal[i] += CommonMotions.cnvInt(wrkobj[2]); |
|
| 536 |
break; |
|
| 537 |
} |
|
| 538 |
} |
|
| 539 |
} |
|
| 540 |
// データセット |
|
| 541 |
CostValue.Add(new PersonExpensesCost(CurData.DepartmentCode |
|
| 542 |
, CurData.PersonCode |
|
| 543 |
, CurData.StartDate |
|
| 544 |
, CurData.CompDate |
|
| 545 |
, new int[] { GetCostVal[0], GetCostVal[1], GetCostVal[2],
|
|
| 546 |
GetCostVal[3],GetCostVal[4],GetCostVal[5], |
|
| 547 |
GetCostVal[6] })); |
|
| 548 |
} |
|
| 549 |
} |
|
| 550 |
catch (Exception ex) |
|
| 551 |
{
|
|
| 552 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
|
|
| 553 |
} |
|
| 554 |
} |
|
| 555 |
#endregion |
|
| 556 |
|
|
| 557 |
#region 経過給与を一括取得する |
|
| 558 |
/// <summary> |
|
| 559 |
/// 経過給与を一括取得する |
|
| 560 |
/// </summary> |
|
| 561 |
public static void GetElapsedSalaryAll(IOMPersonInCharge SalaryDB, int TargetNum, ref ArrayList TargetList, ref List<SalaryClass> ArrarySalary) |
|
| 562 |
{
|
|
| 563 |
try |
|
| 564 |
{
|
|
| 565 |
// 零れた給与日数取得とデータテーブル加工 |
|
| 566 |
CommonMotions.CalcSpilledSalaryAll(SalaryDB, TargetNum, ref TargetList); |
|
| 567 |
|
|
| 568 |
// 給与累積取得 |
|
| 569 |
List<KeyValuePair<int, long>> SalDataList = new List<KeyValuePair<int, long>>(); |
|
| 570 |
CommonMotions.CalcElapsedSalaryAll(SalaryDB, TargetList, ref SalDataList); |
|
| 571 |
|
|
| 572 |
foreach (object[] ObjRec in TargetList) |
|
| 573 |
{
|
|
| 574 |
int nDepartmentCode = CommonMotions.cnvInt(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.DepartmentCode]); |
|
| 575 |
int nPersonCode = CommonMotions.cnvInt(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.PersonCode]); |
|
| 576 |
DateTime stDate = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.StartDate]); |
|
| 577 |
DateTime edDate = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.CompDate]); |
|
| 578 |
|
|
| 579 |
KeyValuePair<int, long> CurValuePair = SalDataList.Find(x => x.Key == nPersonCode); |
|
| 580 |
|
|
| 581 |
// 配列セット |
|
| 582 |
ArrarySalary.Add(new SalaryClass(nDepartmentCode, nPersonCode, (int)CurValuePair.Value, stDate, edDate)); |
|
| 583 |
} |
|
| 584 |
} |
|
| 585 |
catch (Exception ex) |
|
| 586 |
{
|
|
| 587 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
|
|
| 588 |
} |
|
| 589 |
} |
|
| 590 |
#endregion |
|
| 591 |
|
|
| 592 |
#region 担当者毎割当無費目毎の経費を一括取得する |
|
| 593 |
/// <summary> |
|
| 594 |
/// 担当者毎割当無費目毎の経費を一括取得する |
|
| 595 |
/// </summary> |
|
| 596 |
public static void GetPersonExpensesCostValueAll(IOCostDataOfPerson CostDB, |
|
| 597 |
int nNowYear, |
|
| 598 |
List<SalaryClass> ArrarySalary, |
|
| 599 |
ref List<PersonExpensesCost> CostValue) |
|
| 600 |
{
|
|
| 601 |
try |
|
| 602 |
{
|
|
| 603 |
// デフォルト開始・終了を取得する |
|
| 604 |
DateTime dtDefaultStart = CommonMotions.GetOpeningEndDate(nNowYear, true); |
|
| 605 |
DateTime dtDefaultEnd = CommonMotions.GetOpeningEndDate(nNowYear, false); |
|
| 606 |
|
|
| 607 |
// 担当者毎経費データよりどこの工事にも所属していない経費を取得する |
|
| 608 |
bool bFirst = true; |
|
| 609 |
StringBuilder strSQL = new StringBuilder(); |
|
| 610 |
foreach (SalaryClass CurData in ArrarySalary) |
|
| 611 |
{
|
|
| 612 |
if(!bFirst) strSQL.Append(" UNION ");
|
|
| 613 |
strSQL.Append("SELECT");
|
|
| 614 |
strSQL.Append(" PERSONCODE");
|
|
| 615 |
strSQL.Append(", B.DATATYPE AS DATATYPE");
|
|
| 616 |
strSQL.Append(", SUM(B.ENTRYPRICE) AS SUMPRICE");
|
|
| 617 |
strSQL.Append(" FROM");
|
|
| 618 |
strSQL.Append(" COSTDATAOFPERSON AS B");
|
|
| 619 |
strSQL.Append(" WHERE");
|
|
| 620 |
|
|
| 621 |
strSQL.AppendFormat(" B.PERSONCODE = {0}", CurData.PersonCode);
|
|
| 622 |
|
|
| 623 |
strSQL.AppendFormat(" AND (DATE('{0}') <= DATE(B.ACTIONDATE)", dtDefaultStart.ToShortDateString());
|
|
| 624 |
strSQL.AppendFormat(" AND DATE(B.ACTIONDATE) <= DATE('{0}'))", dtDefaultEnd.ToShortDateString());
|
|
| 625 |
strSQL.Append(" AND B.CONSTRUCTIONCODE = 0");
|
|
| 626 |
strSQL.Append(" GROUP BY B.DATATYPE");
|
|
| 627 |
|
|
| 628 |
bFirst = false; |
|
| 629 |
} |
|
| 630 |
// データ取得 |
|
| 631 |
ArrayList arList = new ArrayList(); |
|
| 632 |
if (!CostDB.ExecuteReader(strSQL.ToString(), ref arList)) return; |
|
| 633 |
|
|
| 634 |
// データセット |
|
| 635 |
int[] GetCostVal = new int[CostDataOfPerson.DataNoStrArrary.Length]; |
|
| 636 |
foreach (SalaryClass CurData in ArrarySalary) |
|
| 637 |
{
|
|
| 638 |
Array.Clear(GetCostVal, 0, GetCostVal.Length); |
|
| 639 |
// 取得結果を振り分ける |
|
| 640 |
foreach (object[] wrkobj in arList) |
|
| 641 |
{
|
|
| 642 |
for (int i = (int)CostDataOfPerson.DataNoDef.Transport |
|
| 643 |
; i <= (int)CostDataOfPerson.DataNoDef.DisposalCost |
|
| 644 |
; i++) |
|
| 645 |
{
|
|
| 646 |
GetCostVal[i] = arList.Cast<object[]>().Where(x => CommonMotions.cnvInt(x[0]) == CurData.PersonCode |
|
| 647 |
&& CommonMotions.cnvInt(x[1]) == i) |
|
| 648 |
.Sum(y => CommonMotions.cnvInt(y[2])); |
|
| 649 |
} |
|
| 650 |
} |
|
| 651 |
|
|
| 652 |
CostValue.Add(new PersonExpensesCost(CurData.DepartmentCode |
|
| 653 |
, CurData.PersonCode |
|
| 654 |
, CurData.StartDate |
|
| 655 |
, CurData.CompDate |
|
| 656 |
, new int[] { GetCostVal[0], GetCostVal[1], GetCostVal[2],
|
|
| 657 |
GetCostVal[3],GetCostVal[4],GetCostVal[5], |
|
| 658 |
GetCostVal[6] })); |
|
| 659 |
} |
|
| 660 |
} |
|
| 661 |
catch (Exception ex) |
|
| 662 |
{
|
|
| 663 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
|
|
| 664 |
} |
|
| 665 |
} |
|
| 666 |
#endregion |
|
| 667 |
} |
|
| 668 |
} |
|
| branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedgerList/CommonLedgerData.cs | ||
|---|---|---|
| 1 |
using System; |
|
| 2 |
using System.Collections.Generic; |
|
| 3 |
using System.ComponentModel; |
|
| 4 |
using System.Data; |
|
| 5 |
using System.Drawing; |
|
| 6 |
using System.Linq; |
|
| 7 |
using System.Text; |
|
| 8 |
using System.Windows.Forms; |
|
| 9 |
using System.Collections; |
|
| 10 |
using System.Diagnostics; |
|
| 11 |
using System.Threading; |
|
| 12 |
|
|
| 13 |
using log4net; |
|
| 14 |
using log4net.Appender; |
|
| 15 |
using log4net.Repository.Hierarchy; |
|
| 16 |
|
|
| 17 |
using ProcessManagement.Common; |
|
| 18 |
using ProcessManagement.DB.IOAccess; |
|
| 19 |
using ProcessManagement.DataModel; |
|
| 20 |
using ProcessManagement.DB.Core; |
|
| 21 |
using ProcessManagement.Forms.CustomControls; |
|
| 22 |
using ProcessManagement.Forms.ControlsAction; |
|
| 23 |
using ProcessManagement.Forms.SubForms; |
|
| 24 |
//*---------------------------- 台帳データ取得SQL作成クラス -------------------* |
|
| 25 |
// 2017/08/21 Ver1.0.0.0 Create Source |
|
| 26 |
// |
|
| 27 |
// |
|
| 28 |
// |
|
| 29 |
//*----------------------------------------------------------------------------* |
|
| 30 |
|
|
| 31 |
namespace ProcessManagement.Forms.DataEntry |
|
| 32 |
{
|
|
| 33 |
/// <summary> |
|
| 34 |
/// 台帳データ取得SQL作成クラス |
|
| 35 |
/// </summary> |
|
| 36 |
public static class CommonLedgerData |
|
| 37 |
{
|
|
| 38 |
#region ログ定義 |
|
| 39 |
/// <summary> |
|
| 40 |
/// log4netログを使用する |
|
| 41 |
/// </summary> |
|
| 42 |
private static readonly ILog logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
|
| 43 |
#endregion |
|
| 44 |
|
|
| 45 |
#region 期間データ取得順 |
|
| 46 |
/// <summary> |
|
| 47 |
/// 期間データ取得順 |
|
| 48 |
/// </summary> |
|
| 49 |
public enum GetPersonTerm |
|
| 50 |
{
|
|
| 51 |
DepartmentCode = 0, |
|
| 52 |
/// <summary> |
|
| 53 |
/// 担当者コード |
|
| 54 |
/// </summary> |
|
| 55 |
PersonCode, |
|
| 56 |
/// <summary> |
|
| 57 |
/// 担当者名 |
|
| 58 |
/// </summary> |
|
| 59 |
Personname, |
|
| 60 |
/// <summary> |
|
| 61 |
/// 表示順 |
|
| 62 |
/// </summary> |
|
| 63 |
Displayorder, |
|
| 64 |
/// <summary> |
|
| 65 |
/// 月額給与 |
|
| 66 |
/// </summary> |
|
| 67 |
MonthlySalary, |
|
| 68 |
/// <summary> |
|
| 69 |
/// 契約工期開始 |
|
| 70 |
/// </summary> |
|
| 71 |
StartDate, |
|
| 72 |
/// <summary> |
|
| 73 |
/// 契約工期終了 |
|
| 74 |
/// </summary> |
|
| 75 |
CompDate, |
|
| 76 |
/// <summary> |
|
| 77 |
/// 雇用開始日付 |
|
| 78 |
/// </summary> |
|
| 79 |
HireStartDays, |
|
| 80 |
/// <summary> |
|
| 81 |
/// 雇用終了日付 |
|
| 82 |
/// </summary> |
|
| 83 |
HireCompDays, |
|
| 84 |
/// <summary> |
|
| 85 |
/// 来季契約工期開始 |
|
| 86 |
/// </summary> |
|
| 87 |
NextStartDate, |
|
| 88 |
/// <summary> |
|
| 89 |
/// 来季契約工期終了 |
|
| 90 |
/// </summary> |
|
| 91 |
NextCompDate, |
|
| 92 |
} |
|
| 93 |
#endregion |
|
| 94 |
|
|
| 95 |
#region 部署内の担当者コードを一覧で返す |
|
| 96 |
/// <summary> |
|
| 97 |
/// 部署内の担当者コードを一覧で返す |
|
| 98 |
/// </summary> |
|
| 99 |
public static int GetPersonInDepartment(int BusinessPeriod, int DepartmentCode, int PersonCode, ref ArrayList TargetList) |
|
| 100 |
{
|
|
| 101 |
IOMPersonInCharge PersonDB = new IOMPersonInCharge(); |
|
| 102 |
try |
|
| 103 |
{
|
|
| 104 |
int NotOrder = CommonDefine.ProjectsStatus.First(x => x.Value.Equals("非 受 注")).Key;
|
|
| 105 |
|
|
| 106 |
StringBuilder strSQL = new StringBuilder(); |
|
| 107 |
|
|
| 108 |
DateTime dtDefaultStart = CommonMotions.GetOpeningEndDate(BusinessPeriod, true); |
|
| 109 |
DateTime dtDefaultEnd = CommonMotions.GetOpeningEndDate(BusinessPeriod, false); |
|
| 110 |
|
|
| 111 |
int nPrevYear = (BusinessPeriod - 1); |
|
| 112 |
if (nPrevYear < 0) nPrevYear = 0; |
|
| 113 |
DateTime dtPrevStart = CommonMotions.GetOpeningEndDate(nPrevYear, true); |
|
| 114 |
DateTime dtNextEnd = CommonMotions.GetOpeningEndDate((BusinessPeriod + 1), false); |
|
| 115 |
|
|
| 116 |
strSQL.Append("Select");
|
|
| 117 |
strSQL.Append(" DepHis.DepartmentCode");
|
|
| 118 |
strSQL.Append(", Person.PersonCode");
|
|
| 119 |
strSQL.Append(", Person.PersonName");
|
|
| 120 |
strSQL.Append(", Person.DisplayOrder");
|
|
| 121 |
strSQL.Append(", Person.MonthlySalary");
|
|
| 122 |
strSQL.Append(", Detail.SDate AS StartDate");
|
|
| 123 |
strSQL.Append(", Detail.EDate AS CompDate");
|
|
| 124 |
strSQL.Append(", Person.StartDate AS HireStartDays");
|
|
| 125 |
strSQL.Append(", Person.EndDate AS HireCompDays");
|
|
| 126 |
strSQL.Append(", NextDetail.SDate AS NextStart");
|
|
| 127 |
strSQL.Append(", NextDetail.EDate AS NextEnd");
|
|
| 128 |
strSQL.Append(" From");
|
|
| 129 |
strSQL.Append(" personinchargemaster As Person");
|
|
| 130 |
|
|
| 131 |
strSQL.Append(" Left Join chgchargedep As DepHis");
|
|
| 132 |
strSQL.Append(" ON DepHis.PersonCode = Person.PersonCode");
|
|
| 133 |
strSQL.AppendFormat(" AND ((DATE(DepHis.STARTDATE) <= DATE('{0}'))", dtDefaultEnd.ToShortDateString());
|
|
| 134 |
strSQL.AppendFormat(" AND (DATE('{0}') <= DATE(DepHis.CompDate)", dtDefaultStart.ToShortDateString());
|
|
| 135 |
strSQL.AppendFormat(" OR DATE('{0}') = DATE(DepHis.CompDate)))", DateTime.MinValue.ToShortDateString());
|
|
| 136 |
|
|
| 137 |
// 今期の開始終了(工事開始年月日が先期開始年月日以降を検索する) |
|
| 138 |
strSQL.Append(" Left Join");
|
|
| 139 |
strSQL.Append(" (Select LDetail.CompanyCode As PersonCode");
|
|
| 140 |
strSQL.Append(" , MIN(Ledger.ConstructionStart) As SDate");
|
|
| 141 |
strSQL.Append(" , MAX(Ledger.ConstructionEnd) As EDate");
|
|
| 142 |
strSQL.Append(" From constructionledgerdetail As LDetail");
|
|
| 143 |
strSQL.Append(" Inner Join constructionledger As Ledger");
|
|
| 144 |
strSQL.Append(" On Ledger.ConstructionCode = LDetail.ConstructionCode");
|
|
| 145 |
strSQL.AppendFormat(" And DATE('{0}') <= DATE(Ledger.Constructionstart)", dtPrevStart.ToShortDateString());
|
|
| 146 |
strSQL.Append(" Inner Join constructionbaseinfo As Base");
|
|
| 147 |
strSQL.Append(" On Base.ConstructionCode = LDetail.ConstructionCode");
|
|
| 148 |
strSQL.AppendFormat(" And Base.ConstructionStatusFlg <> {0}", NotOrder);
|
|
| 149 |
strSQL.AppendFormat(" And Base.ConstructionPeriod = {0}", BusinessPeriod);
|
|
| 150 |
strSQL.AppendFormat(" Where LDetail.GroupCount IN ({0}, {1}, {2})"
|
|
| 151 |
, (int)FrmConstructionLedger.DataGroup.Instructor |
|
| 152 |
, (int)FrmConstructionLedger.DataGroup.Assistant |
|
| 153 |
, (int)FrmConstructionLedger.DataGroup.Payroll); |
|
| 154 |
strSQL.Append(" And LDetail.CompanyCode <> 0");
|
|
| 155 |
strSQL.Append(" Group By PersonCode");
|
|
| 156 |
strSQL.Append(" ) As Detail");
|
|
| 157 |
strSQL.Append(" ON Detail.PersonCode = Person.PersonCode");
|
|
| 158 |
|
|
| 159 |
// 来季の開始終了(工事開始年月日が今期開始年月日以降を検索する) |
|
| 160 |
strSQL.Append(" Left Join");
|
|
| 161 |
strSQL.Append(" (Select LDetail2.CompanyCode As PersonCode");
|
|
| 162 |
strSQL.Append(" , MIN(Ledger2.ConstructionStart) As SDate");
|
|
| 163 |
strSQL.Append(" , MAX(Ledger2.ConstructionEnd) As EDate");
|
|
| 164 |
strSQL.Append(" From constructionLedgerdetail As LDetail2");
|
|
| 165 |
strSQL.Append(" Inner Join constructionLedger As Ledger2");
|
|
| 166 |
strSQL.Append(" On Ledger2.ConstructionCode = LDetail2.ConstructionCode");
|
|
| 167 |
strSQL.AppendFormat(" And DATE('{0}') <= DATE(Ledger2.Constructionstart)", dtDefaultStart.ToShortDateString());
|
|
| 168 |
strSQL.Append(" Inner Join constructionbaseinfo As Base");
|
|
| 169 |
strSQL.Append(" On Base.ConstructionCode = LDetail2.ConstructionCode");
|
|
| 170 |
strSQL.AppendFormat(" And Base.ConstructionStatusFlg <> {0}", NotOrder);
|
|
| 171 |
strSQL.AppendFormat(" And Base.ConstructionPeriod = {0}", BusinessPeriod + 1);
|
|
| 172 |
strSQL.AppendFormat(" Where LDetail2.GroupCount IN ({0}, {1}, {2})"
|
|
| 173 |
, (int)FrmConstructionLedger.DataGroup.Instructor |
|
| 174 |
, (int)FrmConstructionLedger.DataGroup.Assistant |
|
| 175 |
, (int)FrmConstructionLedger.DataGroup.Payroll); |
|
| 176 |
strSQL.Append(" And LDetail2.CompanyCode <> 0");
|
|
| 177 |
strSQL.Append(" Group By PersonCode");
|
|
| 178 |
strSQL.Append(" ) As NextDetail");
|
|
| 179 |
strSQL.Append(" ON NextDetail.PersonCode = Person.PersonCode");
|
|
| 180 |
|
|
| 181 |
strSQL.AppendFormat(" Where Person.LEDGERFLG = {0}", (int)PersonInChargeMaster.LedgerDivNoDef.CalcTarget);
|
|
| 182 |
|
|
| 183 |
//if (CommonMotions.LoginUserData.PersonCode != CommonDefine.AdminCode) |
|
| 184 |
//{
|
|
| 185 |
// strSQL.Append(" AND Person.DEPARTMENTCODE IN (select PDep.DepartmentCode from PersonDepartmentMaster AS PDep");
|
|
| 186 |
// strSQL.AppendFormat(" WHERE PDep.PersonCode = {0})", CommonMotions.LoginUserData.PersonCode);
|
|
| 187 |
//} |
|
| 188 |
|
|
| 189 |
// 工事台帳データの部署だけが対象 |
|
| 190 |
if (DepartmentCode > 0) |
|
| 191 |
{
|
|
| 192 |
// 部署コード選択時は部署を検索条件へ入れる |
|
| 193 |
strSQL.AppendFormat(" AND DepHis.DEPARTMENTCODE = {0}", DepartmentCode);
|
|
| 194 |
} |
|
| 195 |
if (PersonCode != 0) strSQL.AppendFormat(" AND Person.PERSONCODE = {0}", PersonCode);
|
|
| 196 |
|
|
| 197 |
strSQL.AppendFormat(" AND ((DATE(Person.STARTDATE) <= DATE('{0}'))", dtDefaultEnd.ToShortDateString());
|
|
| 198 |
strSQL.AppendFormat(" AND (DATE('{0}') <= DATE(Person.ENDDATE)", dtDefaultStart.ToShortDateString());
|
|
| 199 |
strSQL.AppendFormat(" OR DATE('{0}') = DATE(Person.ENDDATE)))", DateTime.MinValue.ToShortDateString());
|
|
| 200 |
|
|
| 201 |
strSQL.AppendFormat(" ORDER BY DepHis.DepartmentCode, Person.EmployeeClassFlg, Person.DISPLAYORDER");
|
|
| 202 |
|
|
| 203 |
if (!PersonDB.ExecuteReader(strSQL.ToString(), ref TargetList)) return 0; |
|
| 204 |
|
|
| 205 |
return TargetList.Count; |
|
| 206 |
} |
|
| 207 |
catch (Exception ex) |
|
| 208 |
{
|
|
| 209 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
|
|
| 210 |
return 0; |
|
| 211 |
} |
|
| 212 |
finally |
|
| 213 |
{
|
|
| 214 |
PersonDB.close(); PersonDB = null; |
|
| 215 |
} |
|
| 216 |
} |
|
| 217 |
#endregion |
|
| 218 |
|
|
| 219 |
#region 経過給与を取得する |
|
| 220 |
/// <summary> |
|
| 221 |
/// 経過給与を取得する |
|
| 222 |
/// </summary> |
|
| 223 |
public static void GetElapsedSalary(IOMPersonInCharge SalaryDB, int TargetNum, ArrayList TargetList, ref List<SalaryClass> ArrarySalary) |
|
| 224 |
{
|
|
| 225 |
try |
|
| 226 |
{
|
|
| 227 |
// デフォルト開始・終了を取得する |
|
| 228 |
DateTime dtDefaultStart = CommonMotions.GetOpeningEndDate(TargetNum, true); |
|
| 229 |
DateTime dtDefaultEnd = CommonMotions.GetOpeningEndDate(TargetNum, false); |
|
| 230 |
DateTime stDate = DateTime.Today; |
|
| 231 |
DateTime edDate = DateTime.Today; |
|
| 232 |
|
|
| 233 |
// 給与を集計する |
|
| 234 |
foreach (object[] ObjRec in TargetList) |
|
| 235 |
{
|
|
| 236 |
// 開始・終了日が無い場合はデフォルトの期首・期末を使用する |
|
| 237 |
stDate = CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.StartDate]); |
|
| 238 |
edDate = CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.CompDate]); |
|
| 239 |
CalcStartCompDate(TargetNum, |
|
| 240 |
dtDefaultStart, dtDefaultEnd, |
|
| 241 |
CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.HireStartDays]), |
|
| 242 |
CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.HireCompDays]), |
|
| 243 |
CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.NextStartDate]), |
|
| 244 |
CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.NextCompDate]), |
|
| 245 |
ref stDate, ref edDate); |
|
| 246 |
|
|
| 247 |
int nDepartmentCode = CommonMotions.cnvInt(ObjRec[(int)CommonLedgerData.GetPersonTerm.DepartmentCode]); |
|
| 248 |
int nPersonCode = CommonMotions.cnvInt(ObjRec[(int)CommonLedgerData.GetPersonTerm.PersonCode]); |
|
| 249 |
|
|
| 250 |
// 零れた給与日数取得 |
|
| 251 |
int TargetY = TargetNum; |
|
| 252 |
int NextDiffDay = 0; |
|
| 253 |
int PrevDiffDay = 0; |
|
| 254 |
CommonMotions.CalcSpilledSalary(SalaryDB, TargetY, stDate, edDate, nPersonCode, ref NextDiffDay, ref PrevDiffDay); |
|
| 255 |
// 今期終了日変更 |
|
| 256 |
DateTime wrkDate = edDate.AddDays(NextDiffDay); |
|
| 257 |
if (dtDefaultEnd.Date < wrkDate.Date) wrkDate = dtDefaultEnd; |
|
| 258 |
ObjRec[(int)CommonLedgerData.GetPersonTerm.CompDate] = wrkDate; |
|
| 259 |
// 今期開始日変更 |
|
| 260 |
wrkDate = stDate.AddDays(PrevDiffDay); |
|
| 261 |
if (dtDefaultEnd.Date < wrkDate.Date) wrkDate = dtDefaultEnd; |
|
| 262 |
ObjRec[(int)CommonLedgerData.GetPersonTerm.StartDate] = wrkDate; |
|
| 263 |
|
|
| 264 |
stDate = CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.StartDate]); |
|
| 265 |
edDate = CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.CompDate]); |
|
| 266 |
|
|
| 267 |
// 給与累積取得 |
|
| 268 |
int workSalary = CommonMotions.CalcElapsedSalary(SalaryDB, stDate, edDate, nPersonCode); |
|
| 269 |
|
|
| 270 |
// 配列セット |
|
他の形式にエクスポート: Unified diff