Index: branches/src/ProcessManagement/ProcessManagement/Common/CommonMotions.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Common/CommonMotions.cs	(revision 343)
+++ branches/src/ProcessManagement/ProcessManagement/Common/CommonMotions.cs	(revision 344)
@@ -2937,9 +2937,9 @@
                 bool bFirst = true;
                 foreach (object[] ObjRec in TargetList)
                 {
-                    int PersonCode = CommonMotions.cnvInt(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.PersonCode]);
-                    DateTime dtStart = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.StartDate]);
-                    DateTime dtLast = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.CompDate]);
+                    int PersonCode = CommonMotions.cnvInt(ObjRec[(int)CommonLedgerData.GetPersonTerm.PersonCode]);
+                    DateTime dtStart = CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.StartDate]);
+                    DateTime dtLast = CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.CompDate]);
 
                     if (!bFirst) strSQL.Append(" UNION ");
 
@@ -3063,17 +3063,17 @@
                 foreach (object[] ObjRec in TargetList)
                 {
                     // é–‹å§‹ãƒ»çµ‚äº†æ—¥ã�Œç„¡ã�„å ´å�ˆã�¯ãƒ‡ãƒ•ã‚©ãƒ«ãƒˆã�®æœŸé¦–ãƒ»æœŸæœ«ã‚’ä½¿ç”¨ã�™ã‚‹
-                    DateTime stDate = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.StartDate]);
-                    DateTime edDate = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.CompDate]);
+                    DateTime stDate = CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.StartDate]);
+                    DateTime edDate = CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.CompDate]);
                     CalcStartCompDate(TargetYear,
                                         dtDefaultStart, dtDefaultEnd,
-                                        CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.HireStartDays]),
-                                        CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.HireCompDays]),
-                                        CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.NextStartDate]),
-                                        CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.NextCompDate]),
+                                        CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.HireStartDays]),
+                                        CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.HireCompDays]),
+                                        CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.NextStartDate]),
+                                        CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.NextCompDate]),
                                         ref stDate, ref edDate);
 
-                    int nPersonCode = CommonMotions.cnvInt(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.PersonCode]);
+                    int nPersonCode = CommonMotions.cnvInt(ObjRec[(int)CommonLedgerData.GetPersonTerm.PersonCode]);
                     wrkStEdDate.Add(new KeyValuePair<DateTime, DateTime>(stDate, edDate));
 
                     // ä»ŠæœŸã�®æœ€åˆ�ã�Œå…ˆæœŸã�®æœ€å¾Œã‚ˆã‚Šå¤§ã��ã�„å ´å�ˆã�¯å‡¦ç�†ã�—ã�ªã�„
@@ -3142,7 +3142,7 @@
                 int DateCnt = 0;
                 foreach (object[] ObjRec in TargetList)
                 {
-                    int nPersonCode = CommonMotions.cnvInt(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.PersonCode]);
+                    int nPersonCode = CommonMotions.cnvInt(ObjRec[(int)CommonLedgerData.GetPersonTerm.PersonCode]);
 
                     // å�Šç«¯åˆ†ã�®æ—¥æ•°ã‚’å�–å¾—ã�™ã‚‹
                     int NextDiffDay = ArData.Cast<object[]>().Where(x => CommonMotions.cnvInt(x[0]) == TargetYear
@@ -3158,11 +3158,11 @@
                     // ä»ŠæœŸçµ‚äº†æ—¥å¤‰æ›´
                     DateTime wrkDate = CurStEd.Value.AddDays(NextDiffDay);
                     if (dtDefaultEnd.Date < wrkDate.Date) wrkDate = dtDefaultEnd;
-                    ObjRec[(int)CreateLedgerSQL.GetPersonTerm.CompDate] = wrkDate;
+                    ObjRec[(int)CommonLedgerData.GetPersonTerm.CompDate] = wrkDate;
                     // ä»ŠæœŸé–‹å§‹æ—¥å¤‰æ›´
                     wrkDate = CurStEd.Key.AddDays(PrevDiffDay);
                     if (dtDefaultEnd.Date < wrkDate.Date) wrkDate = dtDefaultEnd;
-                    ObjRec[(int)CreateLedgerSQL.GetPersonTerm.StartDate] = wrkDate;
+                    ObjRec[(int)CommonLedgerData.GetPersonTerm.StartDate] = wrkDate;
                 }
 
             }
Index: branches/src/ProcessManagement/ProcessManagement/Common/CommonVersion.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Common/CommonVersion.cs	(revision 343)
+++ branches/src/ProcessManagement/ProcessManagement/Common/CommonVersion.cs	(revision 344)
@@ -14,7 +14,7 @@
         /// <summary>
         /// æœ¬ä½“ãƒ�ãƒ¼ã‚¸ãƒ§ãƒ³
         /// </summary>
-        public static int s_SystemVersion = 181;
+        public static int s_SystemVersion = 192;
 
         /// <summary>
         /// ã‚³ãƒ”ãƒ¼ãƒ»ç’°å¢ƒãƒ�ãƒ¼ã‚¸ãƒ§ãƒ³
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ApprovalList/FrmApprovalListAuxiliary.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ApprovalList/FrmApprovalListAuxiliary.cs	(revision 343)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ApprovalList/FrmApprovalListAuxiliary.cs	(revision 344)
@@ -397,6 +397,7 @@
             {
                 cmbConstructionPerson.SelectedIndexChanged -= new EventHandler(this.cmbConstructionPerson_SelectedIndexChanged);
                 int nBeforeCode = CommonMotions.cnvInt(cmbConstructionPerson.SelectedValue);
+                if (CommonMotions.cnvInt(cmbDepartment.SelectedValue) < 1) nBeforeCode = 0;
 
                 cmbConstructionPerson.DataSource = null;
                 cmbConstructionPerson.Items.Clear();
@@ -1298,9 +1299,10 @@
                 PersonRec.DepartmentCode = CommonMotions.cnvInt(objRec[2]);     // •”��ƒR�[ƒh
 
                 // “¯‚¶•”��‚Ì�ê�‡‚Í�ˆ—�‚µ‚È‚¢
-                if (DepartmentCode == PersonRec.DepartmentCode) return true;
+                //if (DepartmentCode == PersonRec.DepartmentCode) return true;
 
                 // •”��ƒRƒ“ƒ{ƒ{ƒbƒNƒX‚Ö•”��ƒR�[ƒhƒZƒbƒg
+                SetcmbDepartment();
                 cmbDepartment.SelectedValue = PersonRec.DepartmentCode;
                 SetcmbPersons();    // ’S“–ŽÒƒRƒ“ƒ{ƒ{ƒbƒNƒX•Ï�X
                 cmbConstructionPerson.SelectedValue = PersonCode;
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstractionList/FrmConstructionListAuxiliary.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstractionList/FrmConstructionListAuxiliary.cs	(revision 343)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstractionList/FrmConstructionListAuxiliary.cs	(revision 344)
@@ -2142,6 +2142,7 @@
             {
                 cmbConstructionPerson.SelectedIndexChanged -= new EventHandler(cmbConstructionPerson_SelectedIndexChanged);
                 int nBeforeCode = CommonMotions.cnvInt(cmbConstructionPerson.SelectedValue);
+                if (CommonMotions.cnvInt(cmbDepartment.SelectedValue) < 1) nBeforeCode = 0;
 
                 cmbConstructionPerson.DataSource = null;
                 cmbConstructionPerson.Items.Clear();
@@ -2221,9 +2222,10 @@
                 PersonRec.DepartmentCode = CommonMotions.cnvInt(objRec[2]);     // •”��ƒR�[ƒh
                                                                                 
                 // “¯‚¶•”��‚Ì�ê�‡‚Í�ˆ—�‚µ‚È‚¢
-                if (DepartmentCode == PersonRec.DepartmentCode) return true;
+                //if (DepartmentCode == PersonRec.DepartmentCode) return true;
 
                 // •”��ƒRƒ“ƒ{ƒ{ƒbƒNƒX‚Ö•”��ƒR�[ƒhƒZƒbƒg
+                SetcmbDepartment();
                 cmbDepartment.SelectedValue = PersonRec.DepartmentCode;
                 SetcmbPersons();    // ’S“–ŽÒƒRƒ“ƒ{ƒ{ƒbƒNƒX•Ï�X
                 cmbConstructionPerson.SelectedValue = PersonCode;
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionBaseInfo/DataChange.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionBaseInfo/DataChange.cs	(revision 343)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionBaseInfo/DataChange.cs	(revision 344)
@@ -1023,11 +1023,11 @@
 
                 /// ƒf�[ƒ^ƒZƒbƒg
                 object[] objRec = (object[])ParentData[0];
-                
+
                 // ----- �HŽ–�Ú�×‘ä’ –¾�×ƒf�[ƒ^�ˆ—�
                 // �HŽ–’S“–ŽÒ
                 bool bChgParson1 = false;
-                if (!LedgerDetailDataSalarySet(LedgerDDB, LedgerEDB,ProcConstrCode, frm, TotalOrdersPrice,
+                if (!LedgerDetailDataSalarySet(LedgerDDB, LedgerEDB, ProcConstrCode, frm, TotalOrdersPrice,
                                                     (int)FrmConstructionLedger.DataGroup.Payroll,
                                                     objRec, LedgerRec, ref bChgParson1)) return false;
 
@@ -1120,9 +1120,13 @@
             try
             {
                 // •Ò�Wƒf�[ƒ^Žæ“¾
-                int TargetParson1 = CommonMotions.cnvInt(((ComboBox)m_DspCtrl[(int)DspCnt.ConstructionPersonCode]).SelectedValue);  // ’S“–ŽÒ
-                int TargetParson2 = CommonMotions.cnvInt(((ComboBox)m_DspCtrl[(int)DspCnt.ConstrSubPersonCode]).SelectedValue);     // •›’S“–ŽÒ
-                int TargetParson3 = CommonMotions.cnvInt(((ComboBox)m_DspCtrl[(int)DspCnt.ConstructionInstructor]).SelectedValue);  // Žw“±ˆõ
+                int TargetDepment1 = CommonMotions.cnvInt(((ComboBox)m_DspCtrl[(int)DspCnt.ConstructionDepartment]).SelectedValue);     // ’S“–ŽÒ•”��
+                int TargetParson1 = CommonMotions.cnvInt(((ComboBox)m_DspCtrl[(int)DspCnt.ConstructionPersonCode]).SelectedValue);      // ’S“–ŽÒ
+                int TargetDepment2 = CommonMotions.cnvInt(((ComboBox)m_DspCtrl[(int)DspCnt.ConstrSubDepartment]).SelectedValue);        // •›’S“–ŽÒ•”��
+                int TargetParson2 = CommonMotions.cnvInt(((ComboBox)m_DspCtrl[(int)DspCnt.ConstrSubPersonCode]).SelectedValue);         // •›’S“–ŽÒ
+                int TargetDepment3 = CommonMotions.cnvInt(((ComboBox)m_DspCtrl[(int)DspCnt.InstructorDepartment]).SelectedValue);       // Žw“±ˆõ•”��
+                int TargetParson3 = CommonMotions.cnvInt(((ComboBox)m_DspCtrl[(int)DspCnt.ConstructionInstructor]).SelectedValue);      // Žw“±ˆõ
+
                 DateTime StartDate = CommonMotions.cnvUndecidedStringToDate(m_DspCtrl[(int)DspCnt.ConstructionPeriodStart2].Text);
                 if (StartDate == DateTime.MinValue)
                     StartDate = CommonMotions.cnvUndecidedStringToDate(m_DspCtrl[(int)DspCnt.ConstructionPeriodStart].Text);
@@ -1139,6 +1143,7 @@
                 bool bExists = LedgerDDB.SelectAction(strSQL.ToString(), ref DetailRec, false);
 
                 int ConstructorCode = 0;
+                int DepartmentCode = 0;
                 double MonthryCost = 0;
                 switch (GroupCode)
                 {
@@ -1145,11 +1150,13 @@
                     // �HŽ–’S“–ŽÒ
                     case (int)FrmConstructionLedger.DataGroup.Payroll:
                         ConstructorCode = TargetParson1;
+                        DepartmentCode = TargetDepment1;
                         MonthryCost = CommonMotions.cnvDouble(objRec[(int)ReadParentOrder.ConstrPersonSalary]);
                         break;
                     // �HŽ–•›’S“–ŽÒ
                     case (int)FrmConstructionLedger.DataGroup.Assistant:
                         ConstructorCode = TargetParson2;
+                        DepartmentCode = TargetDepment2;
                         MonthryCost = CommonDefine.AssistantMonthryCost;
                         break;
 
@@ -1156,6 +1163,7 @@
                     // �HŽ–Žw“±ˆõ
                     case (int)FrmConstructionLedger.DataGroup.Instructor:
                         ConstructorCode = TargetParson3;
+                        DepartmentCode = TargetDepment3;
                         MonthryCost = CommonDefine.InstructorMonthryCost;
                         break;
                 }
@@ -1214,8 +1222,9 @@
                 NewDetailRec.FirstString = frm.GetTitleString;                                      // �€–Ú–¼�Ì
 
                 NewDetailRec.SecondString = string.Empty;                                           // �HŽ–“à—e
+                NewDetailRec.ComponentCode = DepartmentCode;                                       // ’S“–ŽÒ•”��ƒR�[ƒh
                 NewDetailRec.CompanyType = (int)CommonDefine.CodeDataType.Person;                   // ‹¦—Í‰ïŽÐƒR�[ƒhƒ^ƒCƒv
-                NewDetailRec.CompanyCode = ConstructorCode;                                         // ‹¦—Í‰ïŽÐƒR�[ƒh
+                NewDetailRec.CompanyCode = ConstructorCode;                                         // ’S“–ŽÒƒR�[ƒh
                 NewDetailRec.ExecutionAmount = 0;                                                   // ŽÀ�s‹àŠz
                 NewDetailRec.AmountConfigRate = 0;                                                  // ‹àŠz�\�¬—¦
 
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionBudget/FrmConstructionBudgetAuxiliary.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionBudget/FrmConstructionBudgetAuxiliary.cs	(revision 343)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionBudget/FrmConstructionBudgetAuxiliary.cs	(revision 344)
@@ -4615,10 +4615,10 @@
                         // é‡‘é¡�ã�®ç·¨é›†
                         CurCell.Value = CommonMotions.cnvInt(CurCell.Value).ToString("#,0");
 
-                        // å¸Œæœ›é‡‘é¡�ã�Œå®Ÿè¡Œé‡‘é¡�ã‚ˆã‚Šå°�ã�•ã�„å ´å�ˆã�¯é‡‘é¡�ã‚»ãƒƒãƒˆ
+                        // å¸Œæœ›é‡‘é¡�ã�Œå®Ÿè¡Œé‡‘é¡�ã‚ˆã‚Šå°�ã�•ã�„å ´å�ˆã�¯é‡‘é¡�ã‚»ãƒƒãƒˆï¼ˆå¸Œæœ›é‡‘é¡�ã�Œï¼�ã�«ã‚»ãƒƒãƒˆã�•ã‚Œã�Ÿå ´å�ˆã�¯ã‚»ãƒƒãƒˆã�™ã‚‹ï¼‰
                         int nHopePrice = CommonMotions.cnvInt(CurRow.Cells[(int)GridColumn.HopePrice].Value);
                         int nExecPrice = CommonMotions.cnvInt(CurRow.Cells[(int)GridColumn.ExecPrice].Value);
-                        if (nExecPrice == 0 || nHopePrice < nExecPrice)
+                        if (nExecPrice == 0 || nHopePrice < nExecPrice || nHopePrice == 0)
                             CurRow.Cells[(int)GridColumn.ExecPrice].Value = CurCell.Value;
                         break;
                     default:
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionJoin/FrmConstructionJoinAuxiliary.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionJoin/FrmConstructionJoinAuxiliary.cs	(revision 343)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionJoin/FrmConstructionJoinAuxiliary.cs	(revision 344)
@@ -316,6 +316,7 @@
             {
                 cmbConstructionPerson.SelectedIndexChanged -= new EventHandler(cmbConstructionPerson_SelectedIndexChanged);
                 int nBeforeCode = CommonMotions.cnvInt(cmbConstructionPerson.SelectedValue);
+                if (CommonMotions.cnvInt(cmbDepartment.SelectedValue) < 1) nBeforeCode = 0;
 
                 cmbConstructionPerson.DataSource = null;
                 cmbConstructionPerson.Items.Clear();
@@ -396,9 +397,10 @@
                 PersonRec.DepartmentCode = CommonMotions.cnvInt(objRec[2]);     // éƒ¨ç½²ã‚³ãƒ¼ãƒ‰
 
                 // å�Œã�˜éƒ¨ç½²ã�®å ´å�ˆã�¯å‡¦ç�†ã�—ã�ªã�„
-                if (DepartmentCode == PersonRec.DepartmentCode) return true;
+                //if (DepartmentCode == PersonRec.DepartmentCode) return true;
 
                 // éƒ¨ç½²ã‚³ãƒ³ãƒœãƒœãƒƒã‚¯ã‚¹ã�¸éƒ¨ç½²ã‚³ãƒ¼ãƒ‰ã‚»ãƒƒãƒˆ
+                SetcmbDepartment();
                 cmbDepartment.SelectedValue = PersonRec.DepartmentCode;
                 SetcmbPersons();    // æ‹…å½“è€…ã‚³ãƒ³ãƒœãƒœãƒƒã‚¯ã‚¹å¤‰æ›´
                 cmbConstructionPerson.SelectedValue = PersonCode;
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedger/FrmConstructionLedgerAuxiliary.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedger/FrmConstructionLedgerAuxiliary.cs	(revision 343)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedger/FrmConstructionLedgerAuxiliary.cs	(revision 344)
@@ -1574,8 +1574,9 @@
             try
             {
                 // å·¥äº‹äºˆç®—æ›¸æ˜Žç´°ãƒ‡ãƒ¼ã‚¿ã‚’èª­ã�¿è¾¼ã‚€
-                string strSQL = DetailDB.CreatePrimarykeyString(m_ConstructionCode);
-                strSQL += string.Format(" AND GROUPCOUNT IN ({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11})", 
+                StringBuilder strSQL = new StringBuilder();
+                strSQL.Append(DetailDB.CreatePrimarykeyString(m_ConstructionCode));
+                strSQL.AppendFormat(" AND GROUPCOUNT IN ({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11})", 
                                                             (int)FrmConstructionBudget.DataGroup.CommonTempCosts,       // å…±é€šä»®è¨­
                                                             (int)FrmConstructionBudget.DataGroup.OutSourceCosts,        // å¤–æ³¨è²»
                                                             (int)FrmConstructionBudget.DataGroup.MyConstruction,        // è‡ªç¤¾æ–½å·¥
@@ -1590,8 +1591,8 @@
                                                             (int)FrmConstructionBudget.DataGroup.PayrollExpenses        // æ‹…å½“è€…çµ¦ä¸ŽçµŒè²»
                                                             );
 
-                strSQL += " ORDER BY GroupCount ASC, LineCount ASC";
-                DetailDB.SelectAction(strSQL, ref DetailList);
+                strSQL.Append(" ORDER BY GroupCount ASC, LineCount ASC");
+                DetailDB.SelectAction(strSQL.ToString(), ref DetailList);
             }
             catch (Exception ex)
             {
@@ -2208,31 +2209,39 @@
                 int TotalPoint = dgv.ColumnCount + (int)ColPayTotal.Totals;
                 // æ”¯æ‰•å�¯èƒ½é¡�æ¬„ä½�ç½®å�–å¾—
                 int ResultPoint = dgv.ColumnCount + (int)ColPayTotal.Results;
+
+
+                DataGridViewRow[] WorkRow = null;
+                // å¯¾è±¡ãƒ‡ãƒ¼ã‚¿å�–å¾—ï¼ˆã‚°ãƒ«ãƒ¼ãƒ—ã�Œç´”åˆ©ç›Šã‚ˆã‚Šå°�ã�•ã�„ã‚‚ã�®ï¼‰
+                int nGrpNo = (int)GridColumn.GroupCount;
                 // ç´”åˆ©ç›Šæ•°ã�®å�–å¾—
                 int BreakLine = m_CostsRowCount[(int)CostsRowLine.NetIncomeRowLine];
                 // ç´”åˆ©ç›Šã�Œè¡¨ç¤ºã�•ã‚Œã�¦ã�„ã�ªã�‘ã‚Œã�°ã‚°ãƒªãƒƒãƒ‰æœ€å¤§è¡Œã‚’ã‚»ãƒƒãƒˆ
-                if (BreakLine == 0) BreakLine = dgv.Rows.Count;
+                if (BreakLine == 0)
+                {
+                    WorkRow = dgv.Rows.Cast<DataGridViewRow>().ToArray();
+                }
+                else
+                {
+                    WorkRow = dgv.Rows.Cast<DataGridViewRow>().Where(x => CommonMotions.cnvInt(x.Cells[nGrpNo].Value) < (int)DataGroup.NetIncome)
+                                                                                        .ToArray();
+                }
+                EstimateValue = WorkRow.Sum(y => CommonMotions.cnvInt(y.Cells[(int)GridColumn.EstimatePrice].Value));   // ç©�ç®—æ™‚è¦‹ç©�é‡‘é¡�
+                ExecValue = WorkRow.Sum(y => CommonMotions.cnvInt(y.Cells[(int)GridColumn.ExecPrice].Value));           // å®Ÿè¡Œé‡‘é¡�
+                PercentValue = WorkRow.Sum(y => CommonMotions.cnvDouble(y.Cells[(int)GridColumn.Percent].Value));       // æ§‹æˆ�æ¯”çŽ‡
 
+                TotalValue = WorkRow.Sum(y => CommonMotions.cnvInt(y.Cells[TotalPoint].Value));                         // å�ˆè¨ˆé‡‘é¡�
+                ResultValue = WorkRow.Sum(y => CommonMotions.cnvInt(y.Cells[ResultPoint].Value));                       // å®Ÿç¸¾é‡‘é¡�
+
                 // æœˆæ¯Žã‚¯ãƒªã‚¢
                 Array.Clear(MTotal, 0, MTotal.Length);
-                foreach (DataGridViewRow wrkRow in dgv.Rows)
+                // æœˆæ¯ŽåŠ ç®—
+                int arrayCnt = 0;
+                for (int i = (int)GridColumn.Payment; i < dgv.ColumnCount; i++)
                 {
-                    // ç´”åˆ©ç›Šã�®å‰�ã�¾ã�§ã�§å‡¦ç�†çµ‚äº†
-                    if (wrkRow.Index >= BreakLine) break;
+                    MTotal[arrayCnt++] = WorkRow.Sum(y => CommonMotions.cnvInt(y.Cells[i].Value));
+                }
 
-                    EstimateValue += CommonMotions.cnvInt(wrkRow.Cells[(int)GridColumn.EstimatePrice].Value);           // ç©�ç®—æ™‚è¦‹ç©�é‡‘é¡�
-                    ExecValue += CommonMotions.cnvInt(wrkRow.Cells[(int)GridColumn.ExecPrice].Value);                   // å®Ÿè¡Œé‡‘é¡�
-                    PercentValue += CommonMotions.cnvDouble(wrkRow.Cells[(int)GridColumn.Percent].Value);               // æ§‹æˆ�æ¯”çŽ‡
-                    TotalValue += CommonMotions.cnvInt(wrkRow.Cells[TotalPoint].Value);                                 // å�ˆè¨ˆé‡‘é¡�
-                    ResultValue += CommonMotions.cnvInt(wrkRow.Cells[ResultPoint].Value);                               // å®Ÿç¸¾é‡‘é¡�
-
-                    // æœˆæ¯ŽåŠ ç®—
-                    int arrayCnt = 0;
-                    for (int i = (int)GridColumn.Payment; i < dgv.ColumnCount; i++, arrayCnt++)
-                    {
-                        MTotal[arrayCnt] += CommonMotions.cnvInt(wrkRow.Cells[i].Value);
-                    }
-                }
             }
             catch (Exception ex)
             {
@@ -2421,9 +2430,9 @@
 
                     // æœˆæ¯Žå�ˆè¨ˆ
                     int arrayCnt = 0;
-                    for (int i = (int)GridColumn.Payment; i < dgv.ColumnCount; i++, arrayCnt++)
+                    for (int i = (int)GridColumn.Payment; i < dgv.ColumnCount; i++)
                     {
-                        RowData[i] = MTotal[arrayCnt].ToString("#,0");
+                        RowData[i] = MTotal[arrayCnt++].ToString("#,0");
                     }
 
                     // å�ˆè¨ˆæ¬„ä½�ç½®å�–å¾—
@@ -2470,9 +2479,9 @@
 
                     // æœˆæ¯Žå�ˆè¨ˆ
                     int arrayCnt = 0;
-                    for (int i = (int)GridColumn.Payment; i < dgv.ColumnCount; i++, arrayCnt++)
+                    for (int i = (int)GridColumn.Payment; i < dgv.ColumnCount; i++)
                     {
-                        dgv.Rows[LineCnt].Cells[i].Value = MTotal[arrayCnt].ToString("#,0");
+                        dgv.Rows[LineCnt].Cells[i].Value = MTotal[arrayCnt++].ToString("#,0");
                     }
 
                     // å�ˆè¨ˆæ¬„ä½�ç½®å�–å¾—
@@ -2905,10 +2914,10 @@
                 // æ”¯æ‰•æž ï¼ˆåˆ—ï¼‰ã‚’ä½œæˆ�ã�™ã‚‹
                 CreatePaymentColumns(DetailList);
 
+                DataGridView dgv = dgvAllDisplay;
                 // ã‚°ãƒªãƒƒãƒ‰è¡Œå‰Šé™¤
-                dgvAllDisplay.Rows.Clear();
+                dgv.Rows.Clear();
 
-                DataGridView dgv = dgvAllDisplay;
                 int GridColMax = dgv.ColumnCount;
                 int GroupNo = 0;
                 int icnt = 1;
@@ -4237,6 +4246,38 @@
         }
         #endregion
 
+        #region çµŒè²»ã‚’æŽ¢ã�™
+        /// <summary>
+        /// çµŒè²»ã‚’å��ç§°ã�‹ã‚‰æŽ¢ã�™
+        /// </summary>
+        /// <param name="Terget"></param>
+        /// <returns></returns>
+        private int GetExpenss(string Terget, int ExpensesCode)
+        {
+            try
+            {
+                int LineRet = 0;
+
+                DataGridView dgv = dgvAllDisplay;
+                for (int i = 0; i < m_CostsRowCount[(int)CostsRowLine.PurchaseCostsRowLine]; i++)
+                {
+                    if (CommonMotions.cnvString(dgv.Rows[i].Cells[(int)GridColumn.ItemName].Value).IndexOf(Terget) >= 0
+                        || CommonMotions.cnvInt(dgv.Rows[i].Cells[(int)GridColumn.ComponentCode].Value) == ExpensesCode)
+                    {
+                        LineRet = i;
+                        break;
+                    }
+                }
+                return LineRet;
+            }
+            catch (System.Exception ex)
+            {
+                logger.ErrorFormat("ã‚·ã‚¹ãƒ†ãƒ ã‚¨ãƒ©ãƒ¼ï¼š{0}ï¼š{1}", CommonMotions.GetMethodName(), ex.Message);
+                return 0;
+            }
+        }
+        #endregion
+
         // ---------- ãƒ‡ãƒ¼ã‚¿ç™»éŒ²â†“â†“
         #region å·¥äº‹è©³ç´°å�°å¸³ãƒ‡ãƒ¼ã‚¿ç™»éŒ²
         /// <summary>
@@ -4256,7 +4297,6 @@
 
                 int Colcnt = dgv.ColumnCount - (int)GridColumn.Payment;
                 int[] MTotal = new int[Colcnt];
-                int TotalPoint = dgv.ColumnCount + (int)ColPayTotal.Totals;
 
                 // å�ˆè¨ˆå€¤å�–å¾—
                 GetDetailTotal(ref EstimatePriceValue, ref ExecPriceValue, ref PercentValue, ref TotalValue, ref ResultPriceValue, ref MTotal);
@@ -4283,9 +4323,10 @@
                 // ç¨ŽæŠœå�—æ³¨æ±ºå®šé‡‘é¡�
                 work.OrdersDecisionPrice = CommonMotions.cnvDouble(m_DspLabelCtrl[(int)DspLblCtrlName.OrdersPrice].Text);
 
-                //int Rowcnt1 = GetExpenss("ä¼šç¤¾", 3);
-                //int Rowcnt2 = GetExpenss("éƒ¨ç½²", 2);
-                //int Rowcnt3 = GetExpenss("å–¶æ¥­", 1);
+                int TotalPoint = dgv.ColumnCount + (int)ColPayTotal.Totals;
+                int Rowcnt1 = GetExpenss("ä¼šç¤¾", 3);
+                int Rowcnt2 = GetExpenss("éƒ¨ç½²", 2);
+                int Rowcnt3 = GetExpenss("å–¶æ¥­", 1);
                 //for (int i = (int)GridColumn.Payment; i < TotalPoint; i++)
                 //{
                 //    // ä¼šç¤¾çµŒè²»å�ˆè¨ˆ
@@ -4296,6 +4337,23 @@
                 //    work.SalesExpenses += CommonMotions.cnvDouble(dgv.Rows[Rowcnt3].Cells[i].Value);
                 //}
 
+                int nGrpNo = (int)GridColumn.GroupCount;
+                // ä¼šç¤¾çµŒè²»å�ˆè¨ˆ
+                work.CompanyExpenses = dgv.Rows.Cast<DataGridViewRow>().Where(x => CommonMotions.cnvInt(x.Cells[nGrpNo].Value) == (int)DataGroup.Expenses
+                                                                                    && CommonMotions.cnvInt(x.Cells[(int)GridColumn.ComponentCode].Value) == 3)
+                                                                                    .ToArray()
+                                                                                    .Sum(y => CommonMotions.cnvDouble(y.Cells[TotalPoint].Value));
+                // éƒ¨ç½²çµŒè²»å�ˆè¨ˆ
+                work.DepartmentExpenses = dgv.Rows.Cast<DataGridViewRow>().Where(x => CommonMotions.cnvInt(x.Cells[nGrpNo].Value) == (int)DataGroup.Expenses
+                                                                                    && CommonMotions.cnvInt(x.Cells[(int)GridColumn.ComponentCode].Value) == 2)
+                                                                                    .ToArray()
+                                                                                    .Sum(y => CommonMotions.cnvDouble(y.Cells[TotalPoint].Value));
+                // å–¶æ¥­çµŒè²»å�ˆè¨ˆ
+                work.SalesExpenses = dgv.Rows.Cast<DataGridViewRow>().Where(x => CommonMotions.cnvInt(x.Cells[nGrpNo].Value) == (int)DataGroup.Expenses
+                                                                                    && CommonMotions.cnvInt(x.Cells[(int)GridColumn.ComponentCode].Value) == 1)
+                                                                                    .ToArray()
+                                                                                    .Sum(y => CommonMotions.cnvDouble(y.Cells[TotalPoint].Value));
+
                 // å�—æ³¨é‡‘é¡�ç©�ç®—ãƒ•ãƒ©ã‚°
                 if (CommonMotions.CheckCreateLedgerData(m_ConstructionBaseInfo.ConstructionStatusFlg, m_ConstructionBaseInfo.ConstructionType))
                     work.IntegrationFlg = (int)CommonDefine.LedgerIntegration.Integration;
@@ -4310,48 +4368,27 @@
                 //}
 
                 // æ‹…å½“è€…çµ¦ä¸Ž
-                int PayrollRow = m_CostsRowCount[(int)CostsRowLine.PayrollRowLine];
-                if (PayrollRow > 0)
-                {
-                    int GroupNo = 0;
-                    for (int i = PayrollRow; i < dgv.RowCount; i++)
-                    {
-                        GroupNo = CommonMotions.cnvInt(dgv.Rows[i].Cells[(int)GridColumn.GroupCount].Value);
-                        if (GroupNo != (int)DataGroup.Payroll) break;
-                        work.Allowance += CommonMotions.cnvDouble(dgv.Rows[i].Cells[TotalPoint].Value);
-                    }
-                }
+                DataGridViewRow[] PayrollRow = dgv.Rows.Cast<DataGridViewRow>().Where(x => CommonMotions.cnvInt(x.Cells[nGrpNo].Value) == (int)DataGroup.Payroll)
+                                                                                    .ToArray();
+                if (PayrollRow.Count() > 0)
+                    work.Allowance = PayrollRow.Sum(y => CommonMotions.cnvDouble(y.Cells[TotalPoint].Value));
 
                 // å‰¯æ‹…å½“è€…çµ¦ä¸Ž
-                int AssistantRow = m_CostsRowCount[(int)CostsRowLine.AssistantRowLine];
-                double bworkAssistant = 0;
-                if (AssistantRow > 0)
-                {
-                    int GroupNo = 0;
-                    for (int i = AssistantRow; i < dgv.RowCount; i++)
-                    {
-                        GroupNo = CommonMotions.cnvInt(dgv.Rows[i].Cells[(int)GridColumn.GroupCount].Value);
-                        if (GroupNo != (int)DataGroup.Assistant) break;
-                        bworkAssistant += CommonMotions.cnvDouble(dgv.Rows[i].Cells[TotalPoint].Value);
-                    }
-                }
+                double wrkAssist = 0;
+                DataGridViewRow[] AssistantRow = dgv.Rows.Cast<DataGridViewRow>().Where(x => CommonMotions.cnvInt(x.Cells[nGrpNo].Value) == (int)DataGroup.Assistant)
+                                                                                    .ToArray();
+                if (AssistantRow.Count() > 0)
+                    wrkAssist = AssistantRow.Sum(y => CommonMotions.cnvDouble(y.Cells[TotalPoint].Value));
 
                 // æŒ‡å°Žå“¡çµ¦ä¸Ž
-                int InstructorRow = m_CostsRowCount[(int)CostsRowLine.InstructorRowLine];
-                double bworkInstructor = 0;
-                if (InstructorRow > 0)
-                {
-                    int GroupNo = 0;
-                    for (int i = InstructorRow; i < dgv.RowCount; i++)
-                    {
-                        GroupNo = CommonMotions.cnvInt(dgv.Rows[i].Cells[(int)GridColumn.GroupCount].Value);
-                        if (GroupNo != (int)DataGroup.Instructor) break;
-                        bworkInstructor += CommonMotions.cnvDouble(dgv.Rows[i].Cells[TotalPoint].Value);
-                    }
-                }
+                double wrkInstr = 0;
+                DataGridViewRow[] InstructorRow = dgv.Rows.Cast<DataGridViewRow>().Where(x => CommonMotions.cnvInt(x.Cells[nGrpNo].Value) == (int)DataGroup.Instructor)
+                                                                                    .ToArray();
+                if (InstructorRow.Count() > 0)
+                    wrkInstr = InstructorRow.Sum(y => CommonMotions.cnvDouble(y.Cells[TotalPoint].Value));
 
                 // ç·�æ”¯æ‰•é¡�ï¼ˆæ”¯æ‰•é¡�ï¼�ï¼ˆæ‹…å½“è€…çµ¦ä¸Žï¼‹å‰¯æ‹…å½“è€…çµ¦ä¸Žï¼‹æŒ‡å°Žå“¡çµ¦ä¸Žï¼‰ï¼‰
-                double work1 = (work.Allowance + bworkAssistant + bworkInstructor);
+                double work1 = (work.Allowance + wrkAssist + wrkInstr);
                 if (work1 < 0) work1 *= -1;
                 work.TotalPayment = TotalValue - work1;
 
@@ -4363,7 +4400,7 @@
                     BillingValue = CommonMotions.cnvInt(dgv.Rows[BillingLineCnt].Cells[TotalPoint].Value);
                 }
                 // ç²—åˆ©ï¼ˆè«‹æ±‚é‡‘é¡�ï¼�ï¼ˆæ”¯æ‰•é¡�ï¼�ï¼ˆæ‹…å½“è€…çµ¦ä¸Žï¼‹å‰¯æ‹…å½“è€…çµ¦ä¸Žï¼‹æŒ‡å°Žå“¡çµ¦ä¸Žï¼‰ï¼‰ï¼‰
-                double work2 = (TotalValue - (work.Allowance + bworkAssistant + bworkInstructor));
+                double work2 = (TotalValue - (work.Allowance + wrkAssist + wrkInstr));
                 if (work2 < 0) work2 *= -1;
                 work.GrossProfit = BillingValue - work2;
 
@@ -5464,6 +5501,7 @@
                             break;
                     }
                 }
+                DetailRec.CompanyType = (int)CommonDefine.CodeDataType.Person;           // ã‚³ãƒ¼ãƒ‰ã‚¿ã‚¤ãƒ—ï¼ˆæ‹…å½“è€…ï¼‰
 
                 // è¨­å®šç„¡ã�¯å‡¦ç�†ã�—ã�ªã�„
                 if (DetailRec.CompanyCode == 0) return;
@@ -5476,6 +5514,8 @@
                 if (!PersonDB.SelectAction(strSQL, ref PersonRec)) return;
 
                 DetailRec.FirstString = string.Format("{0}ã€�{1}æ°�ã€‘", s_GroupTitle[GroupNo], PersonRec.SealPrintName);
+                DetailRec.ComponentCode = PersonRec.DepartmentCode;
+                
             }
             catch (Exception ex)
             {
@@ -8915,10 +8955,10 @@
 
                     // å†�è¨ˆç®—å‡¦ç�†
                     if (!frm.RecalculateLedger) break;
+
+                    // ç”»é�¢ã‚’é–‰ã�˜ã‚‹
+                    frm.Close();
                 }
-
-                // ç”»é�¢ã‚’é–‰ã�˜ã‚‹
-                frm.Close();
             }
             catch (Exception ex)
             {
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedgerList/CreateLedgerSQL.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedgerList/CreateLedgerSQL.cs	(revision 343)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedgerList/CreateLedgerSQL.cs	(nonexistent)
@@ -1,668 +0,0 @@
-ï»¿using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Windows.Forms;
-using System.Collections;
-using System.Diagnostics;
-using System.Threading;
-
-using log4net;
-using log4net.Appender;
-using log4net.Repository.Hierarchy;
-
-using ProcessManagement.Common;
-using ProcessManagement.DB.IOAccess;
-using ProcessManagement.DataModel;
-using ProcessManagement.DB.Core;
-using ProcessManagement.Forms.CustomControls;
-using ProcessManagement.Forms.ControlsAction;
-using ProcessManagement.Forms.SubForms;
-//*---------------------------- å�°å¸³ãƒ‡ãƒ¼ã‚¿å�–å¾—SQLä½œæˆ�ã‚¯ãƒ©ã‚¹ -------------------*
-//  2017/08/21  Ver1.0.0.0      Create Source           
-//
-//
-//
-//*----------------------------------------------------------------------------*
-
-namespace ProcessManagement.Forms.DataEntry
-{
-    /// <summary>
-    /// å�°å¸³ãƒ‡ãƒ¼ã‚¿å�–å¾—SQLä½œæˆ�ã‚¯ãƒ©ã‚¹
-    /// </summary>
-    public static class CreateLedgerSQL
-    {
-        #region ãƒ­ã‚°å®šç¾©
-        /// <summary>
-        /// log4netãƒ­ã‚°ã‚’ä½¿ç”¨ã�™ã‚‹
-        /// </summary>
-        private static readonly ILog logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
-        #endregion
-
-        #region æœŸé–“ãƒ‡ãƒ¼ã‚¿å�–å¾—é †
-        /// <summary>
-        /// æœŸé–“ãƒ‡ãƒ¼ã‚¿å�–å¾—é †
-        /// </summary>
-        public enum GetPersonTerm
-        {
-            DepartmentCode = 0,
-            /// <summary>
-            /// æ‹…å½“è€…ã‚³ãƒ¼ãƒ‰
-            /// </summary>
-            PersonCode,
-            /// <summary>
-            /// æ‹…å½“è€…å��
-            /// </summary>
-            Personname,
-            /// <summary>
-            /// è¡¨ç¤ºé †
-            /// </summary>
-            Displayorder,
-            /// <summary>
-            /// æœˆé¡�çµ¦ä¸Ž
-            /// </summary>
-            MonthlySalary,
-            /// <summary>
-            /// å¥‘ç´„å·¥æœŸé–‹å§‹
-            /// </summary>
-            StartDate,
-            /// <summary>
-            /// å¥‘ç´„å·¥æœŸçµ‚äº†
-            /// </summary>
-            CompDate,
-            /// <summary>
-            /// é›‡ç”¨é–‹å§‹æ—¥ä»˜
-            /// </summary>
-            HireStartDays,
-            /// <summary>
-            /// é›‡ç”¨çµ‚äº†æ—¥ä»˜
-            /// </summary>
-            HireCompDays,
-            /// <summary>
-            /// æ�¥å­£å¥‘ç´„å·¥æœŸé–‹å§‹
-            /// </summary>
-            NextStartDate,
-            /// <summary>
-            /// æ�¥å­£å¥‘ç´„å·¥æœŸçµ‚äº†
-            /// </summary>
-            NextCompDate,
-        }
-        #endregion
-
-        #region éƒ¨ç½²å†…ã�®æ‹…å½“è€…ã‚³ãƒ¼ãƒ‰ã‚’ä¸€è¦§ã�§è¿”ã�™
-        /// <summary>
-        /// éƒ¨ç½²å†…ã�®æ‹…å½“è€…ã‚³ãƒ¼ãƒ‰ã‚’ä¸€è¦§ã�§è¿”ã�™
-        /// </summary>
-        public static int GetPersonInDepartment(int BusinessPeriod, int DepartmentCode, int PersonCode, ref ArrayList TargetList)
-        {
-            IOMPersonInCharge PersonDB = new IOMPersonInCharge();
-            try
-            {
-                int NotOrder = CommonDefine.ProjectsStatus.First(x => x.Value.Equals("é�ž å�— æ³¨")).Key;
-
-                StringBuilder strSQL = new StringBuilder();
-
-                DateTime dtDefaultStart = CommonMotions.GetOpeningEndDate(BusinessPeriod, true);
-                DateTime dtDefaultEnd = CommonMotions.GetOpeningEndDate(BusinessPeriod, false);
-
-                int nPrevYear = (BusinessPeriod - 1);
-                if (nPrevYear < 0) nPrevYear = 0;
-                DateTime dtPrevStart = CommonMotions.GetOpeningEndDate(nPrevYear, true);
-                DateTime dtNextEnd = CommonMotions.GetOpeningEndDate((BusinessPeriod + 1), false);
-
-                strSQL.Append("Select");
-                strSQL.Append(" DepHis.DepartmentCode");
-                strSQL.Append(", Person.PersonCode");
-                strSQL.Append(", Person.PersonName");
-                strSQL.Append(", Person.DisplayOrder");
-                strSQL.Append(", Person.MonthlySalary");
-                strSQL.Append(", Detail.SDate AS StartDate");
-                strSQL.Append(", Detail.EDate AS CompDate");
-                strSQL.Append(", Person.StartDate AS HireStartDays");
-                strSQL.Append(", Person.EndDate AS HireCompDays");
-                strSQL.Append(", NextDetail.SDate AS NextStart");
-                strSQL.Append(", NextDetail.EDate AS NextEnd");
-                strSQL.Append(" From");
-                strSQL.Append(" personinchargemaster As Person");
-
-                strSQL.Append(" Left Join chgchargedep As DepHis");
-                strSQL.Append(" ON DepHis.PersonCode = Person.PersonCode");
-                strSQL.AppendFormat(" AND ((DATE(DepHis.STARTDATE) <= DATE('{0}'))", dtDefaultEnd.ToShortDateString());
-                strSQL.AppendFormat(" AND (DATE('{0}') <= DATE(DepHis.CompDate)", dtDefaultStart.ToShortDateString());
-                strSQL.AppendFormat(" OR DATE('{0}') = DATE(DepHis.CompDate)))", DateTime.MinValue.ToShortDateString());
-
-                // ä»ŠæœŸã�®é–‹å§‹çµ‚äº†ï¼ˆå·¥äº‹é–‹å§‹å¹´æœˆæ—¥ã�Œå…ˆæœŸé–‹å§‹å¹´æœˆæ—¥ä»¥é™�ã‚’æ¤œç´¢ã�™ã‚‹ï¼‰
-                strSQL.Append(" Left Join");
-                strSQL.Append("      (Select LDetail.CompanyCode As PersonCode");
-                strSQL.Append("            , MIN(Ledger.ConstructionStart) As SDate");
-                strSQL.Append("            , MAX(Ledger.ConstructionEnd) As EDate");
-                strSQL.Append("       From constructionledgerdetail As LDetail");
-                strSQL.Append("            Inner Join constructionledger As Ledger");
-                strSQL.Append("                  On Ledger.ConstructionCode = LDetail.ConstructionCode");
-                strSQL.AppendFormat("             And DATE('{0}') <= DATE(Ledger.Constructionstart)", dtPrevStart.ToShortDateString());
-                strSQL.Append("            Inner Join constructionbaseinfo As Base");
-                strSQL.Append("                  On Base.ConstructionCode = LDetail.ConstructionCode");
-                strSQL.AppendFormat("            And Base.ConstructionStatusFlg <> {0}", NotOrder);
-                strSQL.AppendFormat("            And Base.ConstructionPeriod = {0}", BusinessPeriod);
-                strSQL.AppendFormat(" Where LDetail.GroupCount IN ({0}, {1}, {2})"
-                                                                            , (int)FrmConstructionLedger.DataGroup.Instructor
-                                                                            , (int)FrmConstructionLedger.DataGroup.Assistant
-                                                                            , (int)FrmConstructionLedger.DataGroup.Payroll);
-                strSQL.Append("       And LDetail.CompanyCode <> 0");
-                strSQL.Append("       Group By PersonCode");
-                strSQL.Append("       ) As Detail");
-                strSQL.Append(" ON Detail.PersonCode = Person.PersonCode");
-
-                // æ�¥å­£ã�®é–‹å§‹çµ‚äº†ï¼ˆå·¥äº‹é–‹å§‹å¹´æœˆæ—¥ã�Œä»ŠæœŸé–‹å§‹å¹´æœˆæ—¥ä»¥é™�ã‚’æ¤œç´¢ã�™ã‚‹ï¼‰
-                strSQL.Append(" Left Join");
-                strSQL.Append("      (Select LDetail2.CompanyCode As PersonCode");
-                strSQL.Append("            , MIN(Ledger2.ConstructionStart) As SDate");
-                strSQL.Append("            , MAX(Ledger2.ConstructionEnd) As EDate");
-                strSQL.Append("       From constructionLedgerdetail As LDetail2");
-                strSQL.Append("            Inner Join constructionLedger As Ledger2");
-                strSQL.Append("                  On Ledger2.ConstructionCode = LDetail2.ConstructionCode");
-                strSQL.AppendFormat("             And DATE('{0}') <= DATE(Ledger2.Constructionstart)", dtDefaultStart.ToShortDateString());
-                strSQL.Append("            Inner Join constructionbaseinfo As Base");
-                strSQL.Append("                  On Base.ConstructionCode = LDetail2.ConstructionCode");
-                strSQL.AppendFormat("            And Base.ConstructionStatusFlg <> {0}", NotOrder);
-                strSQL.AppendFormat("            And Base.ConstructionPeriod = {0}", BusinessPeriod + 1);
-                strSQL.AppendFormat(" Where LDetail2.GroupCount IN ({0}, {1}, {2})"
-                                                                            , (int)FrmConstructionLedger.DataGroup.Instructor
-                                                                            , (int)FrmConstructionLedger.DataGroup.Assistant
-                                                                            , (int)FrmConstructionLedger.DataGroup.Payroll);
-                strSQL.Append("       And LDetail2.CompanyCode <> 0");
-                strSQL.Append("       Group By PersonCode");
-                strSQL.Append("       ) As NextDetail");
-                strSQL.Append(" ON NextDetail.PersonCode = Person.PersonCode");
-
-                strSQL.AppendFormat(" Where Person.LEDGERFLG = {0}", (int)PersonInChargeMaster.LedgerDivNoDef.CalcTarget);
-
-                if (CommonMotions.LoginUserData.PersonCode != CommonDefine.AdminCode)
-                {
-                    strSQL.Append(" AND Person.DEPARTMENTCODE IN (select PDep.DepartmentCode from PersonDepartmentMaster AS PDep");
-                    strSQL.AppendFormat(" WHERE PDep.PersonCode = {0})", CommonMotions.LoginUserData.PersonCode);
-                }
-
-                // å·¥äº‹å�°å¸³ãƒ‡ãƒ¼ã‚¿ã�®éƒ¨ç½²ã� ã�‘ã�Œå¯¾è±¡
-                if (DepartmentCode > 0)
-                {
-                    // éƒ¨ç½²ã‚³ãƒ¼ãƒ‰é�¸æŠžæ™‚ã�¯éƒ¨ç½²ã‚’æ¤œç´¢æ�¡ä»¶ã�¸å…¥ã‚Œã‚‹
-                    strSQL.AppendFormat(" AND DepHis.DEPARTMENTCODE = {0}", DepartmentCode);
-                }
-                if (PersonCode != 0) strSQL.AppendFormat(" AND Person.PERSONCODE = {0}", PersonCode);
-
-                strSQL.AppendFormat(" AND ((DATE(Person.STARTDATE) <= DATE('{0}'))", dtDefaultEnd.ToShortDateString());
-                strSQL.AppendFormat(" AND (DATE('{0}') <= DATE(Person.ENDDATE)", dtDefaultStart.ToShortDateString());
-                strSQL.AppendFormat(" OR DATE('{0}') = DATE(Person.ENDDATE)))", DateTime.MinValue.ToShortDateString());
-
-                strSQL.AppendFormat(" ORDER BY DepHis.DepartmentCode, Person.EmployeeClassFlg, Person.DISPLAYORDER");
-
-                if (!PersonDB.ExecuteReader(strSQL.ToString(), ref TargetList)) return 0;
-
-                return TargetList.Count;
-            }
-            catch (Exception ex)
-            {
-                logger.ErrorFormat("ã‚·ã‚¹ãƒ†ãƒ ã‚¨ãƒ©ãƒ¼ï¼š{0}ï¼š{1}", CommonMotions.GetMethodName(), ex.Message);
-                return 0;
-            }
-            finally
-            {
-                PersonDB.close(); PersonDB = null;
-            }
-        }
-        #endregion
-
-        #region çµŒé�Žçµ¦ä¸Žã‚’å�–å¾—ã�™ã‚‹
-        /// <summary>
-        /// çµŒé�Žçµ¦ä¸Žã‚’å�–å¾—ã�™ã‚‹
-        /// </summary>
-        public static void GetElapsedSalary(IOMPersonInCharge SalaryDB, int TargetNum, ArrayList TargetList, ref List<SalaryClass> ArrarySalary)
-        {
-            try
-            {
-                // ãƒ‡ãƒ•ã‚©ãƒ«ãƒˆé–‹å§‹ãƒ»çµ‚äº†ã‚’å�–å¾—ã�™ã‚‹
-                DateTime dtDefaultStart = CommonMotions.GetOpeningEndDate(TargetNum, true);
-                DateTime dtDefaultEnd = CommonMotions.GetOpeningEndDate(TargetNum, false);
-                DateTime stDate = DateTime.Today;
-                DateTime edDate = DateTime.Today;
-
-                // çµ¦ä¸Žã‚’é›†è¨ˆã�™ã‚‹
-                foreach (object[] ObjRec in TargetList)
-                {
-                    // é–‹å§‹ãƒ»çµ‚äº†æ—¥ã�Œç„¡ã�„å ´å�ˆã�¯ãƒ‡ãƒ•ã‚©ãƒ«ãƒˆã�®æœŸé¦–ãƒ»æœŸæœ«ã‚’ä½¿ç”¨ã�™ã‚‹
-                    stDate = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.StartDate]);
-                    edDate = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.CompDate]);
-                    CalcStartCompDate(TargetNum,
-                                        dtDefaultStart, dtDefaultEnd,
-                                        CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.HireStartDays]),
-                                        CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.HireCompDays]),
-                                        CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.NextStartDate]),
-                                        CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.NextCompDate]),
-                                        ref stDate, ref edDate);
-
-                    int nDepartmentCode = CommonMotions.cnvInt(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.DepartmentCode]);
-                    int nPersonCode = CommonMotions.cnvInt(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.PersonCode]);
-
-                    // é›¶ã‚Œã�Ÿçµ¦ä¸Žæ—¥æ•°å�–å¾—
-                    int TargetY = TargetNum;
-                    int NextDiffDay = 0;
-                    int PrevDiffDay = 0;
-                    CommonMotions.CalcSpilledSalary(SalaryDB, TargetY, stDate, edDate, nPersonCode, ref NextDiffDay, ref PrevDiffDay);
-                    // ä»ŠæœŸçµ‚äº†æ—¥å¤‰æ›´
-                    DateTime wrkDate = edDate.AddDays(NextDiffDay);
-                    if (dtDefaultEnd.Date < wrkDate.Date) wrkDate = dtDefaultEnd;
-                    ObjRec[(int)CreateLedgerSQL.GetPersonTerm.CompDate] = wrkDate;
-                    // ä»ŠæœŸé–‹å§‹æ—¥å¤‰æ›´
-                    wrkDate = stDate.AddDays(PrevDiffDay);
-                    if (dtDefaultEnd.Date < wrkDate.Date) wrkDate = dtDefaultEnd;
-                    ObjRec[(int)CreateLedgerSQL.GetPersonTerm.StartDate] = wrkDate;
-
-                    stDate = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.StartDate]);
-                    edDate = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.CompDate]);
-
-                    // çµ¦ä¸Žç´¯ç©�å�–å¾—
-                    int workSalary = CommonMotions.CalcElapsedSalary(SalaryDB, stDate, edDate, nPersonCode);
-
-                    // é…�åˆ—ã‚»ãƒƒãƒˆ
-                    ArrarySalary.Add(new SalaryClass(nDepartmentCode, nPersonCode, workSalary, stDate, edDate));
-                }
-            }
-            catch (Exception ex)
-            {
-                logger.ErrorFormat("ã‚·ã‚¹ãƒ†ãƒ ã‚¨ãƒ©ãƒ¼ï¼š{0}ï¼š{1}", CommonMotions.GetMethodName(), ex.Message);
-            }
-        }
-        #endregion
-
-        #region è¨ˆç®—é–‹å§‹ãƒ»çµ‚äº†æ—¥ã�®ãƒ�ã‚§ãƒƒã‚¯å…¥ã‚Œæ›¿ã�ˆ
-        /// <summary>
-        /// è¨ˆç®—é–‹å§‹ãƒ»çµ‚äº†æ—¥ã�®ãƒ�ã‚§ãƒƒã‚¯å…¥ã‚Œæ›¿ã�ˆ
-        /// </summary>
-        public static void CalcStartCompDate(int BusinessPeriod,
-                                        DateTime dtDefaultStart, DateTime dtDefaultEnd,
-                                        DateTime HireStartDate, DateTime HireCompDate,
-                                        DateTime NextStartDate, DateTime NextCompDate,
-                                        ref DateTime StartDate, ref DateTime CompDate)
-        {
-            try
-            {
-                // ----- è¨ˆç®—é–‹å§‹æ—¥ã‚»ãƒƒãƒˆ
-                if (StartDate == DateTime.MinValue)
-                {
-                    StartDate = dtDefaultStart;
-                }
-                else if (dtDefaultStart <= HireStartDate && HireStartDate <= dtDefaultEnd)
-                {
-                    StartDate = HireStartDate;
-                }
-                else if (dtDefaultStart < StartDate)
-                {
-                    StartDate = dtDefaultStart;
-                }
-                // å…¥ç¤¾æ—¥ã�ŒæœŸå†…ã�ªã‚‰ã�°é–‹å§‹ã‚’å…¥ç¤¾æ—¥ã�«ã�™ã‚‹
-                if (dtDefaultStart < HireStartDate && HireStartDate < dtDefaultEnd) StartDate = HireStartDate;
-
-                // ----- è¨ˆç®—çµ‚äº†æ—¥ã‚»ãƒƒãƒˆ
-                // Defaultã�¯æœŸæœ«
-                CompDate = dtDefaultEnd;
-
-                // é€€ç¤¾æ—¥ã�ŒæœŸå†…ã�ªã‚‰ã�°çµ‚äº†ã‚’é€€ç¤¾æ—¥ã�«ã�™ã‚‹
-                if (dtDefaultStart < HireCompDate && HireCompDate < dtDefaultEnd) CompDate = HireCompDate;
-
-                // æ�¥å­£ã�®é–‹å§‹ã�Œã�‚ã�£ã�¦æœŸæœ«æ—¥ã‚ˆã‚Šå°�ã�•ã�„å ´å�ˆã�¯ç½®ã��æ�›ã�ˆã‚‹
-                if (NextStartDate != DateTime.MinValue)
-                {
-                    if (StartDate < NextStartDate && NextStartDate < CompDate) CompDate = NextStartDate.AddDays(-1);
-                }
-            }
-            catch (Exception ex)
-            {
-                logger.ErrorFormat("ã‚·ã‚¹ãƒ†ãƒ ã‚¨ãƒ©ãƒ¼ï¼š{0}", ex.Message);
-            }
-        }
-        #endregion
-
-        #region å·¥äº‹è©³ç´°å�°å¸³ã‚ˆã‚ŠæŒ¯åˆ†çµ¦ä¸Žé‡‘é¡�ã‚’å�–å¾—ã�™ã‚‹
-        /// <summary>
-        /// å·¥äº‹è©³ç´°å�°å¸³ã‚ˆã‚ŠæŒ¯åˆ†çµ¦ä¸Žé‡‘é¡�ã‚’å�–å¾—ã�™ã‚‹
-        /// </summary>
-        public static void ProfitGeneral(IOConstructionLedger LedgerDB, int ConstructionPeriod,
-                                            int DepartmentCode, int PersonCode, ref int OnSalary,
-                                            bool bExec = true)
-        {
-            try
-            {
-                // éƒ¨ç½²ã‚³ãƒ¼ãƒ‰å�–å¾—
-                int NotOrder = CommonDefine.ProjectsStatus.First(x => x.Value.Equals("é�ž å�— æ³¨")).Key;
-                //  å·¥äº‹äºˆç®—ã�¨è©³ç´°å�°å¸³ã�®ã‚°ãƒ«ãƒ¼ãƒ—ç•ªå�·å·®ã‚’å�–å¾—ã�™ã‚‹
-                int nGroupDiff = (int)FrmConstructionBudget.DataGroup.InstructorCosts - (int)FrmConstructionLedger.DataGroup.Instructor;
-
-                // æŒ¯åˆ†çµ¦ä¸Žé‡‘é¡�å�–å¾—
-                StringBuilder strSQL = new StringBuilder();
-                strSQL.Append("SELECT");
-                if (bExec)
-                    strSQL.Append(" SUM(C2.PAYMENTAMOUNT)");
-                else
-                    strSQL.Append(" SUM(C3.PAYMENTAMOUNT)");
-
-                strSQL.Append(" FROM");
-                strSQL.Append(" CONSTRUCTIONLEDGER P");
-                strSQL.Append(", CONSTRUCTIONBASEINFO B");
-                strSQL.Append(", CONSTRUCTIONLEDGERDETAIL C");
-
-                if (bExec)
-                {
-                    strSQL.Append(" LEFT JOIN");
-                    strSQL.Append(" (Select");
-                    strSQL.Append(" CC2.ConstructionCode AS ConstructionCode");
-                    strSQL.Append(", CC2.GroupCount AS GroupCount");
-                    strSQL.Append(", ifnull(SUM(CC2.PaymentAmount), 0) AS PaymentAmount");
-                    strSQL.Append(" From constructionledgerexcute AS CC2");
-                    strSQL.Append(" Group By CC2.ConstructionCode, CC2.GroupCount");
-                    strSQL.Append(" ) AS C2");
-                    strSQL.Append(" ON C2.ConstructionCode = C.ConstructionCode");
-                    strSQL.Append(" And C2.GroupCount = C.GroupCount");
-                }
-                else
-                {
-                    strSQL.Append(" LEFT JOIN");
-                    strSQL.Append(" (Select");
-                    strSQL.Append(" CC3.ConstructionCode AS ConstructionCode");
-                    strSQL.Append(", CC3.GroupCount AS GroupCount");
-                    strSQL.Append(", ifnull(SUM(CC3.OrderDesiredAmount), 0) AS PaymentAmount");
-                    strSQL.Append(" From constructionbudgetdetail AS CC3");
-                    strSQL.Append(" Group By CC3.ConstructionCode, CC3.GroupCount");
-                    strSQL.Append(") AS C3");
-                    strSQL.Append(" ON ROUND((C3.ConstructionCode / 100), 0) = ROUND((C.ConstructionCode / 100), 0)");
-                    strSQL.AppendFormat(" And C3.GroupCount = (C.GroupCount + {0})", nGroupDiff);
-                }
-
-                // æŒ¯åˆ†ç„¡ã�§ã�¯ç„¡ã�„
-                strSQL.AppendFormat(" WHERE B.CONSTRUCTIONPERIOD = {0}", ConstructionPeriod);
-                strSQL.AppendFormat(" AND B.CONSTRUCTIONSTATUSFLG != {0}", NotOrder);
-                strSQL.Append(" AND B.CONSTRUCTIONCODE = P.CONSTRUCTIONCODE");
-
-                if (DepartmentCode != 0) strSQL.AppendFormat(" AND B.ConstrDepCode = {0}", DepartmentCode);
-                if (PersonCode != 0) strSQL.AppendFormat(" AND B.ConstructionPersonCode = {0}", PersonCode);
-
-                strSQL.Append(" AND C.CONSTRUCTIONCODE = P.CONSTRUCTIONCODE");
-                strSQL.AppendFormat(" AND C.GROUPCOUNT = {0}", (int)FrmConstructionLedger.DataGroup.Payroll);
-                strSQL.Append(" AND C.CompanyCode = B.ConstructionPersonCode");
-
-                if (CommonMotions.LoginUserData.PersonCode != CommonDefine.AdminCode)
-                {
-                    strSQL.Append(" AND B.ConstrDepCode IN (select PDep.DepartmentCode from PersonDepartmentMaster AS PDep");
-                    strSQL.AppendFormat(" WHERE PDep.PersonCode = {0})", CommonMotions.LoginUserData.PersonCode);
-                }
-
-                ArrayList arList = new ArrayList();
-                if (!LedgerDB.ExecuteReader(strSQL.ToString(), ref arList)) return;
-                object[] objSalary = (object[])arList[0];
-                OnSalary = CommonMotions.cnvInt(objSalary[0]);
-            }
-            catch (Exception ex)
-            {
-                logger.ErrorFormat("ã‚·ã‚¹ãƒ†ãƒ ã‚¨ãƒ©ãƒ¼ï¼š{0}ï¼š{1}", CommonMotions.GetMethodName(), ex.Message);
-            }
-        }
-        #endregion 
-
-        #region æ‹…å½“è€…æ¯Žå‰²å½“ç„¡è²»ç›®æ¯Žã�®çµŒè²»ã‚’å�–å¾—ã�™ã‚‹
-        /// <summary>
-        /// æ‹…å½“è€…æ¯Žå‰²å½“ç„¡è²»ç›®æ¯Žã�®çµŒè²»ã‚’å�–å¾—ã�™ã‚‹
-        /// </summary>
-        public static void GetPersonExpensesCostValue(IOCostDataOfPerson CostDB,
-                                                        int DepartmentCode, int PersonCode,
-                                                        DateTime dtStart, DateTime dtEnd,
-                                                        ref int[] CostValue)
-        {
-            try
-            {
-                // æ‹…å½“è€…æ¯ŽçµŒè²»ãƒ‡ãƒ¼ã‚¿ã‚ˆã‚Šã�©ã�“ã�®å·¥äº‹ã�«ã‚‚æ‰€å±žã�—ã�¦ã�„ã�ªã�„çµŒè²»ã‚’å�–å¾—ã�™ã‚‹
-                StringBuilder strSQL = new StringBuilder();
-
-                strSQL.Append(" SELECT");
-                strSQL.Append(" PERSONCODE");
-                strSQL.Append(", B.DATATYPE AS DATATYPE");
-                strSQL.Append(", SUM(B.ENTRYPRICE) AS SUMPRICE");
-                strSQL.Append(" FROM");
-                strSQL.Append(" COSTDATAOFPERSON AS B");
-                strSQL.Append(" WHERE");
-
-                strSQL.Append(" B.PERSONCODE IN (SELECT BPerson.PERSONCODE FROM personinchargemaster As BPerson");
-
-                StringBuilder strSub = new StringBuilder();
-                if (DepartmentCode != 0) strSub.AppendFormat(" BPerson.DepartmentCode = {0}", DepartmentCode);
-                if (PersonCode != 0)
-                {
-                    if (strSub.ToString().Length > 0) strSub.Append(" And");
-                    strSub.AppendFormat(" BPerson.PersonCode = {0}", PersonCode);
-                }
-                if (strSub.ToString().Length > 0)
-                {
-                    strSQL.Append(" Where");
-                    strSQL.Append(strSub.ToString());
-                }
-                strSQL.Append(")");
-
-                strSQL.AppendFormat(" AND (DATE('{0}') <= DATE(B.ACTIONDATE)", dtStart.ToShortDateString());
-                strSQL.AppendFormat(" AND DATE(B.ACTIONDATE) <= DATE('{0}'))", dtEnd.ToShortDateString());
-                strSQL.Append(" AND B.CONSTRUCTIONCODE = 0");
-                strSQL.Append(" GROUP BY B.DATATYPE");
-
-                ArrayList arList = new ArrayList();
-                if (!CostDB.ExecuteReader(strSQL.ToString(), ref arList)) return;
-
-                // å�–å¾—çµ�æžœã‚’æŒ¯ã‚Šåˆ†ã�‘ã‚‹
-                foreach (object[] wrkobj in arList)
-                {
-                    for (int i = 1; i < CostDataOfPerson.DataNoStrArrary.Length; i++)
-                    {
-                        if (CommonMotions.cnvInt(wrkobj[1]) == i)
-                        {
-                            CostValue[i] += CommonMotions.cnvInt(wrkobj[2]);
-                            break;
-                        }
-                    }
-                }
-            }
-            catch (Exception ex)
-            {
-                logger.ErrorFormat("ã‚·ã‚¹ãƒ†ãƒ ã‚¨ãƒ©ãƒ¼ï¼š{0}ï¼š{1}", CommonMotions.GetMethodName(), ex.Message);
-            }
-        }
-        #endregion
-        
-        #region æ‹…å½“è€…æ¯Žå‰²å½“ç„¡è²»ç›®æ¯Žã�®çµŒè²»ã‚’å�–å¾—ã�™ã‚‹ï¼ˆä¸€æ‹¬ãƒ�ãƒ¼ã‚¸ãƒ§ãƒ³ï¼‰
-        /// <summary>
-        /// æ‹…å½“è€…æ¯Žå‰²å½“ç„¡è²»ç›®æ¯Žã�®çµŒè²»ã‚’å�–å¾—ã�™ã‚‹ï¼ˆä¸€æ‹¬ãƒ�ãƒ¼ã‚¸ãƒ§ãƒ³ï¼‰
-        /// </summary>
-        public static void GetPersonExpensesCostValue(IOCostDataOfPerson CostDB,
-                                                        int nNowYear,
-                                                        List<SalaryClass> ArrarySalary,
-                                                        ref List<PersonExpensesCost> CostValue)
-        {
-            try
-            {
-                // ãƒ‡ãƒ•ã‚©ãƒ«ãƒˆé–‹å§‹ãƒ»çµ‚äº†ã‚’å�–å¾—ã�™ã‚‹
-                DateTime dtDefaultStart = CommonMotions.GetOpeningEndDate(nNowYear, true);
-                DateTime dtDefaultEnd = CommonMotions.GetOpeningEndDate(nNowYear, false);
-
-                // æ‹…å½“è€…æ¯ŽçµŒè²»ãƒ‡ãƒ¼ã‚¿ã‚ˆã‚Šã�©ã�“ã�®å·¥äº‹ã�«ã‚‚æ‰€å±žã�—ã�¦ã�„ã�ªã�„çµŒè²»ã‚’å�–å¾—ã�™ã‚‹
-                StringBuilder strSQL = new StringBuilder();
-
-                strSQL.Append(" SELECT");
-                strSQL.Append(" PERSONCODE");
-                strSQL.Append(", B.DATATYPE AS DATATYPE");
-                strSQL.Append(", SUM(B.ENTRYPRICE) AS SUMPRICE");
-                strSQL.Append(" FROM");
-                strSQL.Append(" COSTDATAOFPERSON AS B");
-                strSQL.Append(" WHERE");
-
-                int[] GetCostVal = new int[CostDataOfPerson.DataNoStrArrary.Length];
-                ArrayList arList = new ArrayList();
-                StringBuilder strWhere = new StringBuilder();
-                StringBuilder strExec = new StringBuilder();
-                foreach (SalaryClass CurData in ArrarySalary)
-                {
-                    strWhere.Clear();
-                    strExec.Clear();
-                    strWhere.AppendFormat(" B.PERSONCODE = {0}", CurData.PersonCode);
-
-                    strWhere.AppendFormat(" AND (DATE('{0}') <= DATE(B.ACTIONDATE)", dtDefaultStart.ToShortDateString());
-                    strWhere.AppendFormat(" AND DATE(B.ACTIONDATE) <= DATE('{0}'))", dtDefaultEnd.ToShortDateString());
-                    strWhere.Append(" AND B.CONSTRUCTIONCODE = 0");
-                    strWhere.Append(" GROUP BY B.DATATYPE");
-
-                    strExec.Append(strSQL.ToString());
-                    strExec.Append(strWhere.ToString());
-
-                    arList.Clear();
-                    if (!CostDB.ExecuteReader(strExec.ToString(), ref arList)) continue;
-
-                    Array.Clear(GetCostVal, 0, GetCostVal.Length);
-                    // å�–å¾—çµ�æžœã‚’æŒ¯ã‚Šåˆ†ã�‘ã‚‹
-                    foreach (object[] wrkobj in arList)
-                    {
-                        for (int i = 1; i < CostDataOfPerson.DataNoStrArrary.Length; i++)
-                        {
-                            if (CommonMotions.cnvInt(wrkobj[1]) == i)
-                            {
-                                GetCostVal[i] += CommonMotions.cnvInt(wrkobj[2]);
-                                break;
-                            }
-                        }
-                    }
-                    // ãƒ‡ãƒ¼ã‚¿ã‚»ãƒƒãƒˆ
-                    CostValue.Add(new PersonExpensesCost(CurData.DepartmentCode
-                                                            , CurData.PersonCode
-                                                            , CurData.StartDate
-                                                            , CurData.CompDate
-                                                            , new int[] { GetCostVal[0], GetCostVal[1], GetCostVal[2],
-                                                                            GetCostVal[3],GetCostVal[4],GetCostVal[5],
-                                                                            GetCostVal[6] }));
-                }
-            }
-            catch (Exception ex)
-            {
-                logger.ErrorFormat("ã‚·ã‚¹ãƒ†ãƒ ã‚¨ãƒ©ãƒ¼ï¼š{0}ï¼š{1}", CommonMotions.GetMethodName(), ex.Message);
-            }
-        }
-        #endregion
-
-        #region çµŒé�Žçµ¦ä¸Žã‚’ä¸€æ‹¬å�–å¾—ã�™ã‚‹
-        /// <summary>
-        /// çµŒé�Žçµ¦ä¸Žã‚’ä¸€æ‹¬å�–å¾—ã�™ã‚‹
-        /// </summary>
-        public static void GetElapsedSalaryAll(IOMPersonInCharge SalaryDB, int TargetNum, ref ArrayList TargetList, ref List<SalaryClass> ArrarySalary)
-        {
-            try
-            {
-                // é›¶ã‚Œã�Ÿçµ¦ä¸Žæ—¥æ•°å�–å¾—ã�¨ãƒ‡ãƒ¼ã‚¿ãƒ†ãƒ¼ãƒ–ãƒ«åŠ å·¥
-                CommonMotions.CalcSpilledSalaryAll(SalaryDB, TargetNum, ref TargetList);
-
-                // çµ¦ä¸Žç´¯ç©�å�–å¾—
-                List<KeyValuePair<int, long>> SalDataList = new List<KeyValuePair<int, long>>();
-                CommonMotions.CalcElapsedSalaryAll(SalaryDB, TargetList, ref SalDataList);
-
-                foreach (object[] ObjRec in TargetList)
-                {
-                    int nDepartmentCode = CommonMotions.cnvInt(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.DepartmentCode]);
-                    int nPersonCode = CommonMotions.cnvInt(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.PersonCode]);
-                    DateTime stDate = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.StartDate]);
-                    DateTime edDate = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.CompDate]);
-
-                    KeyValuePair<int, long> CurValuePair = SalDataList.Find(x => x.Key == nPersonCode);
-
-                    // é…�åˆ—ã‚»ãƒƒãƒˆ
-                    ArrarySalary.Add(new SalaryClass(nDepartmentCode, nPersonCode, (int)CurValuePair.Value, stDate, edDate));
-                }
-            }
-            catch (Exception ex)
-            {
-                logger.ErrorFormat("ã‚·ã‚¹ãƒ†ãƒ ã‚¨ãƒ©ãƒ¼ï¼š{0}ï¼š{1}", CommonMotions.GetMethodName(), ex.Message);
-            }
-        }
-        #endregion
-
-        #region æ‹…å½“è€…æ¯Žå‰²å½“ç„¡è²»ç›®æ¯Žã�®çµŒè²»ã‚’ä¸€æ‹¬å�–å¾—ã�™ã‚‹
-        /// <summary>
-        /// æ‹…å½“è€…æ¯Žå‰²å½“ç„¡è²»ç›®æ¯Žã�®çµŒè²»ã‚’ä¸€æ‹¬å�–å¾—ã�™ã‚‹
-        /// </summary>
-        public static void GetPersonExpensesCostValueAll(IOCostDataOfPerson CostDB,
-                                                        int nNowYear,
-                                                        List<SalaryClass> ArrarySalary,
-                                                        ref List<PersonExpensesCost> CostValue)
-        {
-            try
-            {
-                // ãƒ‡ãƒ•ã‚©ãƒ«ãƒˆé–‹å§‹ãƒ»çµ‚äº†ã‚’å�–å¾—ã�™ã‚‹
-                DateTime dtDefaultStart = CommonMotions.GetOpeningEndDate(nNowYear, true);
-                DateTime dtDefaultEnd = CommonMotions.GetOpeningEndDate(nNowYear, false);
-
-                // æ‹…å½“è€…æ¯ŽçµŒè²»ãƒ‡ãƒ¼ã‚¿ã‚ˆã‚Šã�©ã�“ã�®å·¥äº‹ã�«ã‚‚æ‰€å±žã�—ã�¦ã�„ã�ªã�„çµŒè²»ã‚’å�–å¾—ã�™ã‚‹
-                bool bFirst = true;
-                StringBuilder strSQL = new StringBuilder();
-                foreach (SalaryClass CurData in ArrarySalary)
-                {
-                    if(!bFirst) strSQL.Append(" UNION ");
-                    strSQL.Append("SELECT");
-                    strSQL.Append(" PERSONCODE");
-                    strSQL.Append(", B.DATATYPE AS DATATYPE");
-                    strSQL.Append(", SUM(B.ENTRYPRICE) AS SUMPRICE");
-                    strSQL.Append(" FROM");
-                    strSQL.Append(" COSTDATAOFPERSON AS B");
-                    strSQL.Append(" WHERE");
-
-                    strSQL.AppendFormat(" B.PERSONCODE = {0}", CurData.PersonCode);
-
-                    strSQL.AppendFormat(" AND (DATE('{0}') <= DATE(B.ACTIONDATE)", dtDefaultStart.ToShortDateString());
-                    strSQL.AppendFormat(" AND DATE(B.ACTIONDATE) <= DATE('{0}'))", dtDefaultEnd.ToShortDateString());
-                    strSQL.Append(" AND B.CONSTRUCTIONCODE = 0");
-                    strSQL.Append(" GROUP BY B.DATATYPE");
-
-                    bFirst = false;
-                }
-                // ãƒ‡ãƒ¼ã‚¿å�–å¾—
-                ArrayList arList = new ArrayList();
-                if (!CostDB.ExecuteReader(strSQL.ToString(), ref arList)) return;
-
-                // ãƒ‡ãƒ¼ã‚¿ã‚»ãƒƒãƒˆ
-                int[] GetCostVal = new int[CostDataOfPerson.DataNoStrArrary.Length];
-                foreach (SalaryClass CurData in ArrarySalary)
-                {
-                    Array.Clear(GetCostVal, 0, GetCostVal.Length);
-                    // å�–å¾—çµ�æžœã‚’æŒ¯ã‚Šåˆ†ã�‘ã‚‹
-                    foreach (object[] wrkobj in arList)
-                    {
-                        for (int i = (int)CostDataOfPerson.DataNoDef.Transport
-                                    ; i <= (int)CostDataOfPerson.DataNoDef.DisposalCost
-                                    ; i++)
-                        {
-                            GetCostVal[i] = arList.Cast<object[]>().Where(x => CommonMotions.cnvInt(x[0]) == CurData.PersonCode
-                                                                            && CommonMotions.cnvInt(x[1]) == i)
-                                                                    .Sum(y => CommonMotions.cnvInt(y[2]));
-                        }
-                    }
-
-                    CostValue.Add(new PersonExpensesCost(CurData.DepartmentCode
-                                                            , CurData.PersonCode
-                                                            , CurData.StartDate
-                                                            , CurData.CompDate
-                                                            , new int[] { GetCostVal[0], GetCostVal[1], GetCostVal[2],
-                                                                                GetCostVal[3],GetCostVal[4],GetCostVal[5],
-                                                                                GetCostVal[6] }));
-                }
-            }
-            catch (Exception ex)
-            {
-                logger.ErrorFormat("ã‚·ã‚¹ãƒ†ãƒ ã‚¨ãƒ©ãƒ¼ï¼š{0}ï¼š{1}", CommonMotions.GetMethodName(), ex.Message);
-            }
-        }
-        #endregion
-    }
-}
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedgerList/CommonLedgerData.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedgerList/CommonLedgerData.cs	(nonexistent)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedgerList/CommonLedgerData.cs	(revision 344)
@@ -0,0 +1,722 @@
+ï»¿using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+using System.Collections;
+using System.Diagnostics;
+using System.Threading;
+
+using log4net;
+using log4net.Appender;
+using log4net.Repository.Hierarchy;
+
+using ProcessManagement.Common;
+using ProcessManagement.DB.IOAccess;
+using ProcessManagement.DataModel;
+using ProcessManagement.DB.Core;
+using ProcessManagement.Forms.CustomControls;
+using ProcessManagement.Forms.ControlsAction;
+using ProcessManagement.Forms.SubForms;
+//*---------------------------- å�°å¸³ãƒ‡ãƒ¼ã‚¿å�–å¾—SQLä½œæˆ�ã‚¯ãƒ©ã‚¹ -------------------*
+//  2017/08/21  Ver1.0.0.0      Create Source           
+//
+//
+//
+//*----------------------------------------------------------------------------*
+
+namespace ProcessManagement.Forms.DataEntry
+{
+    /// <summary>
+    /// å�°å¸³ãƒ‡ãƒ¼ã‚¿å�–å¾—SQLä½œæˆ�ã‚¯ãƒ©ã‚¹
+    /// </summary>
+    public static class CommonLedgerData
+    {
+        #region ãƒ­ã‚°å®šç¾©
+        /// <summary>
+        /// log4netãƒ­ã‚°ã‚’ä½¿ç”¨ã�™ã‚‹
+        /// </summary>
+        private static readonly ILog logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
+        #endregion
+
+        #region æœŸé–“ãƒ‡ãƒ¼ã‚¿å�–å¾—é †
+        /// <summary>
+        /// æœŸé–“ãƒ‡ãƒ¼ã‚¿å�–å¾—é †
+        /// </summary>
+        public enum GetPersonTerm
+        {
+            DepartmentCode = 0,
+            /// <summary>
+            /// æ‹…å½“è€…ã‚³ãƒ¼ãƒ‰
+            /// </summary>
+            PersonCode,
+            /// <summary>
+            /// æ‹…å½“è€…å��
+            /// </summary>
+            Personname,
+            /// <summary>
+            /// è¡¨ç¤ºé †
+            /// </summary>
+            Displayorder,
+            /// <summary>
+            /// æœˆé¡�çµ¦ä¸Ž
+            /// </summary>
+            MonthlySalary,
+            /// <summary>
+            /// å¥‘ç´„å·¥æœŸé–‹å§‹
+            /// </summary>
+            StartDate,
+            /// <summary>
+            /// å¥‘ç´„å·¥æœŸçµ‚äº†
+            /// </summary>
+            CompDate,
+            /// <summary>
+            /// é›‡ç”¨é–‹å§‹æ—¥ä»˜
+            /// </summary>
+            HireStartDays,
+            /// <summary>
+            /// é›‡ç”¨çµ‚äº†æ—¥ä»˜
+            /// </summary>
+            HireCompDays,
+            /// <summary>
+            /// æ�¥å­£å¥‘ç´„å·¥æœŸé–‹å§‹
+            /// </summary>
+            NextStartDate,
+            /// <summary>
+            /// æ�¥å­£å¥‘ç´„å·¥æœŸçµ‚äº†
+            /// </summary>
+            NextCompDate,
+        }
+        #endregion
+
+        #region éƒ¨ç½²å†…ã�®æ‹…å½“è€…ã‚³ãƒ¼ãƒ‰ã‚’ä¸€è¦§ã�§è¿”ã�™
+        /// <summary>
+        /// éƒ¨ç½²å†…ã�®æ‹…å½“è€…ã‚³ãƒ¼ãƒ‰ã‚’ä¸€è¦§ã�§è¿”ã�™
+        /// </summary>
+        public static int GetPersonInDepartment(int BusinessPeriod, int DepartmentCode, int PersonCode, ref ArrayList TargetList)
+        {
+            IOMPersonInCharge PersonDB = new IOMPersonInCharge();
+            try
+            {
+                int NotOrder = CommonDefine.ProjectsStatus.First(x => x.Value.Equals("é�ž å�— æ³¨")).Key;
+
+                StringBuilder strSQL = new StringBuilder();
+
+                DateTime dtDefaultStart = CommonMotions.GetOpeningEndDate(BusinessPeriod, true);
+                DateTime dtDefaultEnd = CommonMotions.GetOpeningEndDate(BusinessPeriod, false);
+
+                int nPrevYear = (BusinessPeriod - 1);
+                if (nPrevYear < 0) nPrevYear = 0;
+                DateTime dtPrevStart = CommonMotions.GetOpeningEndDate(nPrevYear, true);
+                DateTime dtNextEnd = CommonMotions.GetOpeningEndDate((BusinessPeriod + 1), false);
+
+                strSQL.Append("Select");
+                strSQL.Append(" DepHis.DepartmentCode");
+                strSQL.Append(", Person.PersonCode");
+                strSQL.Append(", Person.PersonName");
+                strSQL.Append(", Person.DisplayOrder");
+                strSQL.Append(", Person.MonthlySalary");
+                strSQL.Append(", Detail.SDate AS StartDate");
+                strSQL.Append(", Detail.EDate AS CompDate");
+                strSQL.Append(", Person.StartDate AS HireStartDays");
+                strSQL.Append(", Person.EndDate AS HireCompDays");
+                strSQL.Append(", NextDetail.SDate AS NextStart");
+                strSQL.Append(", NextDetail.EDate AS NextEnd");
+                strSQL.Append(" From");
+                strSQL.Append(" personinchargemaster As Person");
+
+                strSQL.Append(" Left Join chgchargedep As DepHis");
+                strSQL.Append(" ON DepHis.PersonCode = Person.PersonCode");
+                strSQL.AppendFormat(" AND ((DATE(DepHis.STARTDATE) <= DATE('{0}'))", dtDefaultEnd.ToShortDateString());
+                strSQL.AppendFormat(" AND (DATE('{0}') <= DATE(DepHis.CompDate)", dtDefaultStart.ToShortDateString());
+                strSQL.AppendFormat(" OR DATE('{0}') = DATE(DepHis.CompDate)))", DateTime.MinValue.ToShortDateString());
+
+                // ä»ŠæœŸã�®é–‹å§‹çµ‚äº†ï¼ˆå·¥äº‹é–‹å§‹å¹´æœˆæ—¥ã�Œå…ˆæœŸé–‹å§‹å¹´æœˆæ—¥ä»¥é™�ã‚’æ¤œç´¢ã�™ã‚‹ï¼‰
+                strSQL.Append(" Left Join");
+                strSQL.Append("      (Select LDetail.CompanyCode As PersonCode");
+                strSQL.Append("            , MIN(Ledger.ConstructionStart) As SDate");
+                strSQL.Append("            , MAX(Ledger.ConstructionEnd) As EDate");
+                strSQL.Append("       From constructionledgerdetail As LDetail");
+                strSQL.Append("            Inner Join constructionledger As Ledger");
+                strSQL.Append("                  On Ledger.ConstructionCode = LDetail.ConstructionCode");
+                strSQL.AppendFormat("             And DATE('{0}') <= DATE(Ledger.Constructionstart)", dtPrevStart.ToShortDateString());
+                strSQL.Append("            Inner Join constructionbaseinfo As Base");
+                strSQL.Append("                  On Base.ConstructionCode = LDetail.ConstructionCode");
+                strSQL.AppendFormat("            And Base.ConstructionStatusFlg <> {0}", NotOrder);
+                strSQL.AppendFormat("            And Base.ConstructionPeriod = {0}", BusinessPeriod);
+                strSQL.AppendFormat(" Where LDetail.GroupCount IN ({0}, {1}, {2})"
+                                                                            , (int)FrmConstructionLedger.DataGroup.Instructor
+                                                                            , (int)FrmConstructionLedger.DataGroup.Assistant
+                                                                            , (int)FrmConstructionLedger.DataGroup.Payroll);
+                strSQL.Append("       And LDetail.CompanyCode <> 0");
+                strSQL.Append("       Group By PersonCode");
+                strSQL.Append("       ) As Detail");
+                strSQL.Append(" ON Detail.PersonCode = Person.PersonCode");
+
+                // æ�¥å­£ã�®é–‹å§‹çµ‚äº†ï¼ˆå·¥äº‹é–‹å§‹å¹´æœˆæ—¥ã�Œä»ŠæœŸé–‹å§‹å¹´æœˆæ—¥ä»¥é™�ã‚’æ¤œç´¢ã�™ã‚‹ï¼‰
+                strSQL.Append(" Left Join");
+                strSQL.Append("      (Select LDetail2.CompanyCode As PersonCode");
+                strSQL.Append("            , MIN(Ledger2.ConstructionStart) As SDate");
+                strSQL.Append("            , MAX(Ledger2.ConstructionEnd) As EDate");
+                strSQL.Append("       From constructionLedgerdetail As LDetail2");
+                strSQL.Append("            Inner Join constructionLedger As Ledger2");
+                strSQL.Append("                  On Ledger2.ConstructionCode = LDetail2.ConstructionCode");
+                strSQL.AppendFormat("             And DATE('{0}') <= DATE(Ledger2.Constructionstart)", dtDefaultStart.ToShortDateString());
+                strSQL.Append("            Inner Join constructionbaseinfo As Base");
+                strSQL.Append("                  On Base.ConstructionCode = LDetail2.ConstructionCode");
+                strSQL.AppendFormat("            And Base.ConstructionStatusFlg <> {0}", NotOrder);
+                strSQL.AppendFormat("            And Base.ConstructionPeriod = {0}", BusinessPeriod + 1);
+                strSQL.AppendFormat(" Where LDetail2.GroupCount IN ({0}, {1}, {2})"
+                                                                            , (int)FrmConstructionLedger.DataGroup.Instructor
+                                                                            , (int)FrmConstructionLedger.DataGroup.Assistant
+                                                                            , (int)FrmConstructionLedger.DataGroup.Payroll);
+                strSQL.Append("       And LDetail2.CompanyCode <> 0");
+                strSQL.Append("       Group By PersonCode");
+                strSQL.Append("       ) As NextDetail");
+                strSQL.Append(" ON NextDetail.PersonCode = Person.PersonCode");
+
+                strSQL.AppendFormat(" Where Person.LEDGERFLG = {0}", (int)PersonInChargeMaster.LedgerDivNoDef.CalcTarget);
+
+                //if (CommonMotions.LoginUserData.PersonCode != CommonDefine.AdminCode)
+                //{
+                //    strSQL.Append(" AND Person.DEPARTMENTCODE IN (select PDep.DepartmentCode from PersonDepartmentMaster AS PDep");
+                //    strSQL.AppendFormat(" WHERE PDep.PersonCode = {0})", CommonMotions.LoginUserData.PersonCode);
+                //}
+
+                // å·¥äº‹å�°å¸³ãƒ‡ãƒ¼ã‚¿ã�®éƒ¨ç½²ã� ã�‘ã�Œå¯¾è±¡
+                if (DepartmentCode > 0)
+                {
+                    // éƒ¨ç½²ã‚³ãƒ¼ãƒ‰é�¸æŠžæ™‚ã�¯éƒ¨ç½²ã‚’æ¤œç´¢æ�¡ä»¶ã�¸å…¥ã‚Œã‚‹
+                    strSQL.AppendFormat(" AND DepHis.DEPARTMENTCODE = {0}", DepartmentCode);
+                }
+                if (PersonCode != 0) strSQL.AppendFormat(" AND Person.PERSONCODE = {0}", PersonCode);
+
+                strSQL.AppendFormat(" AND ((DATE(Person.STARTDATE) <= DATE('{0}'))", dtDefaultEnd.ToShortDateString());
+                strSQL.AppendFormat(" AND (DATE('{0}') <= DATE(Person.ENDDATE)", dtDefaultStart.ToShortDateString());
+                strSQL.AppendFormat(" OR DATE('{0}') = DATE(Person.ENDDATE)))", DateTime.MinValue.ToShortDateString());
+
+                strSQL.AppendFormat(" ORDER BY DepHis.DepartmentCode, Person.EmployeeClassFlg, Person.DISPLAYORDER");
+
+                if (!PersonDB.ExecuteReader(strSQL.ToString(), ref TargetList)) return 0;
+
+                return TargetList.Count;
+            }
+            catch (Exception ex)
+            {
+                logger.ErrorFormat("ã‚·ã‚¹ãƒ†ãƒ ã‚¨ãƒ©ãƒ¼ï¼š{0}ï¼š{1}", CommonMotions.GetMethodName(), ex.Message);
+                return 0;
+            }
+            finally
+            {
+                PersonDB.close(); PersonDB = null;
+            }
+        }
+        #endregion
+
+        #region çµŒé�Žçµ¦ä¸Žã‚’å�–å¾—ã�™ã‚‹
+        /// <summary>
+        /// çµŒé�Žçµ¦ä¸Žã‚’å�–å¾—ã�™ã‚‹
+        /// </summary>
+        public static void GetElapsedSalary(IOMPersonInCharge SalaryDB, int TargetNum, ArrayList TargetList, ref List<SalaryClass> ArrarySalary)
+        {
+            try
+            {
+                // ãƒ‡ãƒ•ã‚©ãƒ«ãƒˆé–‹å§‹ãƒ»çµ‚äº†ã‚’å�–å¾—ã�™ã‚‹
+                DateTime dtDefaultStart = CommonMotions.GetOpeningEndDate(TargetNum, true);
+                DateTime dtDefaultEnd = CommonMotions.GetOpeningEndDate(TargetNum, false);
+                DateTime stDate = DateTime.Today;
+                DateTime edDate = DateTime.Today;
+
+                // çµ¦ä¸Žã‚’é›†è¨ˆã�™ã‚‹
+                foreach (object[] ObjRec in TargetList)
+                {
+                    // é–‹å§‹ãƒ»çµ‚äº†æ—¥ã�Œç„¡ã�„å ´å�ˆã�¯ãƒ‡ãƒ•ã‚©ãƒ«ãƒˆã�®æœŸé¦–ãƒ»æœŸæœ«ã‚’ä½¿ç”¨ã�™ã‚‹
+                    stDate = CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.StartDate]);
+                    edDate = CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.CompDate]);
+                    CalcStartCompDate(TargetNum,
+                                        dtDefaultStart, dtDefaultEnd,
+                                        CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.HireStartDays]),
+                                        CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.HireCompDays]),
+                                        CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.NextStartDate]),
+                                        CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.NextCompDate]),
+                                        ref stDate, ref edDate);
+
+                    int nDepartmentCode = CommonMotions.cnvInt(ObjRec[(int)CommonLedgerData.GetPersonTerm.DepartmentCode]);
+                    int nPersonCode = CommonMotions.cnvInt(ObjRec[(int)CommonLedgerData.GetPersonTerm.PersonCode]);
+
+                    // é›¶ã‚Œã�Ÿçµ¦ä¸Žæ—¥æ•°å�–å¾—
+                    int TargetY = TargetNum;
+                    int NextDiffDay = 0;
+                    int PrevDiffDay = 0;
+                    CommonMotions.CalcSpilledSalary(SalaryDB, TargetY, stDate, edDate, nPersonCode, ref NextDiffDay, ref PrevDiffDay);
+                    // ä»ŠæœŸçµ‚äº†æ—¥å¤‰æ›´
+                    DateTime wrkDate = edDate.AddDays(NextDiffDay);
+                    if (dtDefaultEnd.Date < wrkDate.Date) wrkDate = dtDefaultEnd;
+                    ObjRec[(int)CommonLedgerData.GetPersonTerm.CompDate] = wrkDate;
+                    // ä»ŠæœŸé–‹å§‹æ—¥å¤‰æ›´
+                    wrkDate = stDate.AddDays(PrevDiffDay);
+                    if (dtDefaultEnd.Date < wrkDate.Date) wrkDate = dtDefaultEnd;
+                    ObjRec[(int)CommonLedgerData.GetPersonTerm.StartDate] = wrkDate;
+
+                    stDate = CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.StartDate]);
+                    edDate = CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.CompDate]);
+
+                    // çµ¦ä¸Žç´¯ç©�å�–å¾—
+                    int workSalary = CommonMotions.CalcElapsedSalary(SalaryDB, stDate, edDate, nPersonCode);
+
+                    // é…�åˆ—ã‚»ãƒƒãƒˆ
+                    ArrarySalary.Add(new SalaryClass(nDepartmentCode, nPersonCode, workSalary, stDate, edDate));
+                }
+            }
+            catch (Exception ex)
+            {
+                logger.ErrorFormat("ã‚·ã‚¹ãƒ†ãƒ ã‚¨ãƒ©ãƒ¼ï¼š{0}ï¼š{1}", CommonMotions.GetMethodName(), ex.Message);
+            }
+        }
+        #endregion
+
+        #region è¨ˆç®—é–‹å§‹ãƒ»çµ‚äº†æ—¥ã�®ãƒ�ã‚§ãƒƒã‚¯å…¥ã‚Œæ›¿ã�ˆ
+        /// <summary>
+        /// è¨ˆç®—é–‹å§‹ãƒ»çµ‚äº†æ—¥ã�®ãƒ�ã‚§ãƒƒã‚¯å…¥ã‚Œæ›¿ã�ˆ
+        /// </summary>
+        public static void CalcStartCompDate(int BusinessPeriod,
+                                        DateTime dtDefaultStart, DateTime dtDefaultEnd,
+                                        DateTime HireStartDate, DateTime HireCompDate,
+                                        DateTime NextStartDate, DateTime NextCompDate,
+                                        ref DateTime StartDate, ref DateTime CompDate)
+        {
+            try
+            {
+                // ----- è¨ˆç®—é–‹å§‹æ—¥ã‚»ãƒƒãƒˆ
+                if (StartDate == DateTime.MinValue)
+                {
+                    StartDate = dtDefaultStart;
+                }
+                else if (dtDefaultStart <= HireStartDate && HireStartDate <= dtDefaultEnd)
+                {
+                    StartDate = HireStartDate;
+                }
+                else if (dtDefaultStart < StartDate)
+                {
+                    StartDate = dtDefaultStart;
+                }
+                // å…¥ç¤¾æ—¥ã�ŒæœŸå†…ã�ªã‚‰ã�°é–‹å§‹ã‚’å…¥ç¤¾æ—¥ã�«ã�™ã‚‹
+                if (dtDefaultStart < HireStartDate && HireStartDate < dtDefaultEnd) StartDate = HireStartDate;
+
+                // ----- è¨ˆç®—çµ‚äº†æ—¥ã‚»ãƒƒãƒˆ
+                // Defaultã�¯æœŸæœ«
+                CompDate = dtDefaultEnd;
+
+                // é€€ç¤¾æ—¥ã�ŒæœŸå†…ã�ªã‚‰ã�°çµ‚äº†ã‚’é€€ç¤¾æ—¥ã�«ã�™ã‚‹
+                if (dtDefaultStart < HireCompDate && HireCompDate < dtDefaultEnd) CompDate = HireCompDate;
+
+                // æ�¥å­£ã�®é–‹å§‹ã�Œã�‚ã�£ã�¦æœŸæœ«æ—¥ã‚ˆã‚Šå°�ã�•ã�„å ´å�ˆã�¯ç½®ã��æ�›ã�ˆã‚‹
+                if (NextStartDate != DateTime.MinValue)
+                {
+                    if (StartDate < NextStartDate && NextStartDate < CompDate) CompDate = NextStartDate.AddDays(-1);
+                }
+            }
+            catch (Exception ex)
+            {
+                logger.ErrorFormat("ã‚·ã‚¹ãƒ†ãƒ ã‚¨ãƒ©ãƒ¼ï¼š{0}", ex.Message);
+            }
+        }
+        #endregion
+
+        #region å·¥äº‹è©³ç´°å�°å¸³ã‚ˆã‚ŠæŒ¯åˆ†çµ¦ä¸Žé‡‘é¡�ã‚’å�–å¾—ã�™ã‚‹
+        /// <summary>
+        /// å·¥äº‹è©³ç´°å�°å¸³ã‚ˆã‚ŠæŒ¯åˆ†çµ¦ä¸Žé‡‘é¡�ã‚’å�–å¾—ã�™ã‚‹
+        /// </summary>
+        public static void ProfitGeneral(IOConstructionLedger LedgerDB, int TargetYear,
+                                            int DepartmentCode, int PersonCode, ref int OnSalary,
+                                            bool bExec = true)
+        {
+            try
+            {
+                // éƒ¨ç½²ã‚³ãƒ¼ãƒ‰å�–å¾—
+                int NotOrder = CommonDefine.ProjectsStatus.First(x => x.Value.Equals("é�ž å�— æ³¨")).Key;
+
+                // æŒ¯åˆ†çµ¦ä¸Žé‡‘é¡�å�–å¾—
+                StringBuilder strSQL = new StringBuilder();
+                if (bExec)
+                {
+                    strSQL.Append("SELECT");
+                    strSQL.Append(" SUM(A.PAYMENTAMOUNT)");
+                    strSQL.Append(" FROM");
+                    strSQL.Append("   constructionledgerexcute AS A");
+                    strSQL.Append("   Inner Join constructionledgerdetail AS B");
+                    strSQL.Append("          On B.ConstructionCode = A.ConstructionCode");
+                    strSQL.Append("          And B.GroupCount = A.GroupCount");
+                    strSQL.Append("          And B.LineCount = A.LineCount");
+
+                    if (DepartmentCode != 0)
+                        strSQL.AppendFormat("    AND B.ComponentCode = {0}", DepartmentCode);
+                    if (PersonCode != 0)
+                        strSQL.AppendFormat(" AND B.CompanyCode = {0}", PersonCode);
+
+                    strSQL.Append("   Inner Join CONSTRUCTIONBASEINFO As C");
+                    strSQL.Append("          On C.ConstructionCode = A.ConstructionCode");
+                    strSQL.AppendFormat("    And C.CONSTRUCTIONPERIOD = {0}", TargetYear);
+                    strSQL.AppendFormat("    AND C.CONSTRUCTIONSTATUSFLG != {0}", NotOrder);
+
+                    strSQL.Append(" Where");
+                    strSQL.AppendFormat("   A.GroupCount = {0}", (int)FrmConstructionLedger.DataGroup.Payroll);
+                }
+                else
+                {
+                    strSQL.Append("SELECT");
+                    strSQL.Append(" SUM(A.ExecutionAmount)");
+                    strSQL.Append(" From");
+                    strSQL.Append("    CONSTRUCTIONLEDGERDETAIL A");
+                    strSQL.Append("    Inner JOIN CONSTRUCTIONBASEINFO As B");
+                    strSQL.Append("           On B.ConstructionCode = A.ConstructionCode");
+                    strSQL.AppendFormat("     And B.CONSTRUCTIONPERIOD = {0}", TargetYear);
+                    strSQL.AppendFormat("     AND B.CONSTRUCTIONSTATUSFLG != {0}", NotOrder);
+
+                    strSQL.Append(" Where");
+                    strSQL.AppendFormat(" A.GroupCount = {0}", (int)FrmConstructionLedger.DataGroup.Payroll);
+
+                    if (DepartmentCode != 0)
+                        strSQL.AppendFormat(" AND A.ComponentCode = {0}", DepartmentCode);
+                    if (PersonCode != 0)
+                        strSQL.AppendFormat(" AND A.CompanyCode = {0}", PersonCode);
+                }
+
+                ArrayList arList = new ArrayList();
+                if (!LedgerDB.ExecuteReader(strSQL.ToString(), ref arList)) return;
+
+                foreach (object[] objSalary in arList)
+                {
+                    OnSalary += CommonMotions.cnvInt(objSalary[0]);
+                }
+            }
+            catch (Exception ex)
+            {
+                logger.ErrorFormat("ã‚·ã‚¹ãƒ†ãƒ ã‚¨ãƒ©ãƒ¼ï¼š{0}ï¼š{1}", CommonMotions.GetMethodName(), ex.Message);
+            }
+        }
+        #endregion 
+
+        #region æ‹…å½“è€…æ¯Žå‰²å½“ç„¡è²»ç›®æ¯Žã�®çµŒè²»ã‚’å�–å¾—ã�™ã‚‹
+        /// <summary>
+        /// æ‹…å½“è€…æ¯Žå‰²å½“ç„¡è²»ç›®æ¯Žã�®çµŒè²»ã‚’å�–å¾—ã�™ã‚‹
+        /// </summary>
+        public static void GetPersonExpensesCostValue(IOCostDataOfPerson CostDB,
+                                                        int DepartmentCode, int PersonCode,
+                                                        DateTime dtStart, DateTime dtEnd,
+                                                        ref int[] CostValue)
+        {
+            try
+            {
+                // æ‹…å½“è€…æ¯ŽçµŒè²»ãƒ‡ãƒ¼ã‚¿ã‚ˆã‚Šã�©ã�“ã�®å·¥äº‹ã�«ã‚‚æ‰€å±žã�—ã�¦ã�„ã�ªã�„çµŒè²»ã‚’å�–å¾—ã�™ã‚‹
+                StringBuilder strSQL = new StringBuilder();
+
+                strSQL.Append(" SELECT");
+                strSQL.Append(" PERSONCODE");
+                strSQL.Append(", B.DATATYPE AS DATATYPE");
+                strSQL.Append(", SUM(B.ENTRYPRICE) AS SUMPRICE");
+                strSQL.Append(" FROM");
+                strSQL.Append(" COSTDATAOFPERSON AS B");
+                strSQL.Append(" WHERE");
+
+                strSQL.Append(" B.PERSONCODE IN (SELECT BPerson.PERSONCODE FROM personinchargemaster As BPerson");
+
+                StringBuilder strSub = new StringBuilder();
+                if (DepartmentCode != 0) strSub.AppendFormat(" BPerson.DepartmentCode = {0}", DepartmentCode);
+                if (PersonCode != 0)
+                {
+                    if (strSub.ToString().Length > 0) strSub.Append(" And");
+                    strSub.AppendFormat(" BPerson.PersonCode = {0}", PersonCode);
+                }
+                if (strSub.ToString().Length > 0)
+                {
+                    strSQL.Append(" Where");
+                    strSQL.Append(strSub.ToString());
+                }
+                strSQL.Append(")");
+
+                strSQL.AppendFormat(" AND (DATE('{0}') <= DATE(B.ACTIONDATE)", dtStart.ToShortDateString());
+                strSQL.AppendFormat(" AND DATE(B.ACTIONDATE) <= DATE('{0}'))", dtEnd.ToShortDateString());
+                strSQL.Append(" AND B.CONSTRUCTIONCODE = 0");
+                strSQL.Append(" GROUP BY B.DATATYPE");
+
+                ArrayList arList = new ArrayList();
+                if (!CostDB.ExecuteReader(strSQL.ToString(), ref arList)) return;
+
+                // å�–å¾—çµ�æžœã‚’æŒ¯ã‚Šåˆ†ã�‘ã‚‹
+                foreach (object[] wrkobj in arList)
+                {
+                    for (int i = 1; i < CostDataOfPerson.DataNoStrArrary.Length; i++)
+                    {
+                        if (CommonMotions.cnvInt(wrkobj[1]) == i)
+                        {
+                            CostValue[i] += CommonMotions.cnvInt(wrkobj[2]);
+                            break;
+                        }
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                logger.ErrorFormat("ã‚·ã‚¹ãƒ†ãƒ ã‚¨ãƒ©ãƒ¼ï¼š{0}ï¼š{1}", CommonMotions.GetMethodName(), ex.Message);
+            }
+        }
+        #endregion
+
+        #region çµŒé�Žçµ¦ä¸Žã‚’ä¸€æ‹¬å�–å¾—ã�™ã‚‹
+        /// <summary>
+        /// çµŒé�Žçµ¦ä¸Žã‚’ä¸€æ‹¬å�–å¾—ã�™ã‚‹
+        /// </summary>
+        public static void GetElapsedSalaryAll(IOMPersonInCharge SalaryDB, int TargetNum, ref ArrayList TargetList, ref List<SalaryClass> ArrarySalary)
+        {
+            try
+            {
+                // é›¶ã‚Œã�Ÿçµ¦ä¸Žæ—¥æ•°å�–å¾—ã�¨ãƒ‡ãƒ¼ã‚¿ãƒ†ãƒ¼ãƒ–ãƒ«åŠ å·¥
+                CommonMotions.CalcSpilledSalaryAll(SalaryDB, TargetNum, ref TargetList);
+
+                // çµ¦ä¸Žç´¯ç©�å�–å¾—
+                List<KeyValuePair<int, long>> SalDataList = new List<KeyValuePair<int, long>>();
+                CommonMotions.CalcElapsedSalaryAll(SalaryDB, TargetList, ref SalDataList);
+
+                foreach (object[] ObjRec in TargetList)
+                {
+                    int nDepartmentCode = CommonMotions.cnvInt(ObjRec[(int)CommonLedgerData.GetPersonTerm.DepartmentCode]);
+                    int nPersonCode = CommonMotions.cnvInt(ObjRec[(int)CommonLedgerData.GetPersonTerm.PersonCode]);
+                    DateTime stDate = CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.StartDate]);
+                    DateTime edDate = CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.CompDate]);
+
+                    KeyValuePair<int, long> CurValuePair = SalDataList.Find(x => x.Key == nPersonCode);
+
+                    // é…�åˆ—ã‚»ãƒƒãƒˆ
+                    ArrarySalary.Add(new SalaryClass(nDepartmentCode, nPersonCode, (int)CurValuePair.Value, stDate, edDate));
+                }
+            }
+            catch (Exception ex)
+            {
+                logger.ErrorFormat("ã‚·ã‚¹ãƒ†ãƒ ã‚¨ãƒ©ãƒ¼ï¼š{0}ï¼š{1}", CommonMotions.GetMethodName(), ex.Message);
+            }
+        }
+        #endregion
+
+        #region æ‹…å½“è€…æ¯Žå‰²å½“ç„¡è²»ç›®æ¯Žã�®çµŒè²»ã‚’ä¸€æ‹¬å�–å¾—ã�™ã‚‹
+        /// <summary>
+        /// æ‹…å½“è€…æ¯Žå‰²å½“ç„¡è²»ç›®æ¯Žã�®çµŒè²»ã‚’ä¸€æ‹¬å�–å¾—ã�™ã‚‹
+        /// </summary>
+        public static void GetPersonExpensesCostValueAll(IOCostDataOfPerson CostDB,
+                                                        int nNowYear,
+                                                        List<SalaryClass> ArrarySalary,
+                                                        ref List<PersonExpensesCost> CostValue)
+        {
+            try
+            {
+                // ãƒ‡ãƒ•ã‚©ãƒ«ãƒˆé–‹å§‹ãƒ»çµ‚äº†ã‚’å�–å¾—ã�™ã‚‹
+                DateTime dtDefaultStart = CommonMotions.GetOpeningEndDate(nNowYear, true);
+                DateTime dtDefaultEnd = CommonMotions.GetOpeningEndDate(nNowYear, false);
+
+                // æ‹…å½“è€…æ¯ŽçµŒè²»ãƒ‡ãƒ¼ã‚¿ã‚ˆã‚Šã�©ã�“ã�®å·¥äº‹ã�«ã‚‚æ‰€å±žã�—ã�¦ã�„ã�ªã�„çµŒè²»ã‚’å�–å¾—ã�™ã‚‹
+                bool bFirst = true;
+                StringBuilder strSQL = new StringBuilder();
+                foreach (SalaryClass CurData in ArrarySalary)
+                {
+                    if(!bFirst) strSQL.Append(" UNION ");
+                    strSQL.Append("SELECT");
+                    strSQL.Append(" PERSONCODE");
+                    strSQL.Append(", B.DATATYPE AS DATATYPE");
+                    strSQL.Append(", SUM(B.ENTRYPRICE) AS SUMPRICE");
+                    strSQL.Append(" FROM");
+                    strSQL.Append(" COSTDATAOFPERSON AS B");
+                    strSQL.Append(" WHERE");
+
+                    strSQL.AppendFormat(" B.PERSONCODE = {0}", CurData.PersonCode);
+
+                    strSQL.AppendFormat(" AND (DATE('{0}') <= DATE(B.ACTIONDATE)", dtDefaultStart.ToShortDateString());
+                    strSQL.AppendFormat(" AND DATE(B.ACTIONDATE) <= DATE('{0}'))", dtDefaultEnd.ToShortDateString());
+                    strSQL.Append(" AND B.CONSTRUCTIONCODE = 0");
+                    strSQL.Append(" GROUP BY B.DATATYPE");
+
+                    bFirst = false;
+                }
+                // ãƒ‡ãƒ¼ã‚¿å�–å¾—
+                ArrayList arList = new ArrayList();
+                if (!CostDB.ExecuteReader(strSQL.ToString(), ref arList)) return;
+
+                // ãƒ‡ãƒ¼ã‚¿ã‚»ãƒƒãƒˆ
+                int[] GetCostVal = new int[CostDataOfPerson.DataNoStrArrary.Length];
+                foreach (SalaryClass CurData in ArrarySalary)
+                {
+                    Array.Clear(GetCostVal, 0, GetCostVal.Length);
+                    // å�–å¾—çµ�æžœã‚’æŒ¯ã‚Šåˆ†ã�‘ã‚‹
+                    foreach (object[] wrkobj in arList)
+                    {
+                        for (int i = (int)CostDataOfPerson.DataNoDef.Transport
+                                    ; i <= (int)CostDataOfPerson.DataNoDef.DisposalCost
+                                    ; i++)
+                        {
+                            GetCostVal[i] = arList.Cast<object[]>().Where(x => CommonMotions.cnvInt(x[0]) == CurData.PersonCode
+                                                                            && CommonMotions.cnvInt(x[1]) == i)
+                                                                    .Sum(y => CommonMotions.cnvInt(y[2]));
+                        }
+                    }
+
+                    CostValue.Add(new PersonExpensesCost(CurData.DepartmentCode
+                                                            , CurData.PersonCode
+                                                            , CurData.StartDate
+                                                            , CurData.CompDate
+                                                            , new int[] { GetCostVal[0], GetCostVal[1], GetCostVal[2],
+                                                                                GetCostVal[3],GetCostVal[4],GetCostVal[5],
+                                                                                GetCostVal[6] }));
+                }
+            }
+            catch (Exception ex)
+            {
+                logger.ErrorFormat("ã‚·ã‚¹ãƒ†ãƒ ã‚¨ãƒ©ãƒ¼ï¼š{0}ï¼š{1}", CommonMotions.GetMethodName(), ex.Message);
+            }
+        }
+        #endregion
+
+        #region æ‹…å½“è€…æ¯Žã�®è£œåŠ©æŒ¯åˆ†ã‚’å�–å¾—ã�™ã‚‹
+        /// <summary>
+        /// æ‹…å½“è€…æ¯Žã�®è£œåŠ©æŒ¯åˆ†ã‚’å�–å¾—ã�™ã‚‹
+        /// </summary>
+        /// <param name="PersonCDArray"></param>
+        /// <param name="CostValue"></param>
+        public static void GetPersonAuxiliaryCostValue(int TargetYear, int DepartmentCode, int PersonCode, ref int[] CostValue)
+        {
+            IOConstructionLedgerDetail DetailDB = new IOConstructionLedgerDetail();
+            try
+            {
+                int NotOrder = CommonDefine.ProjectsStatus.First(x => x.Value.Equals("é�ž å�— æ³¨")).Key;
+
+                // å·¥äº‹è©³ç´°å�°å¸³ãƒ‡ãƒ¼ã‚¿ã‚ˆã‚Šè£œåŠ©æŒ¯åˆ†ã‚’å�–å¾—ã�™ã‚‹
+                StringBuilder strSQL = new StringBuilder();
+
+                strSQL.Append("SELECT");
+                strSQL.Append(" C.GROUPCOUNT");
+                strSQL.Append(", SUM(B.PAYMENTAMOUNT)");
+                strSQL.Append(" FROM");
+                strSQL.Append(" CONSTRUCTIONLEDGEREXCUTE B");
+                strSQL.Append(" LEFT JOIN CONSTRUCTIONLEDGERDETAIL C");
+                strSQL.Append("       ON C.CONSTRUCTIONCODE = B.CONSTRUCTIONCODE");
+                strSQL.Append("       AND C.GROUPCOUNT = B.GROUPCOUNT");
+                strSQL.Append("       AND C.LINECOUNT = B.LINECOUNT");
+                strSQL.Append(" Inner Join CONSTRUCTIONBASEINFO A");
+                strSQL.Append("        On A.CONSTRUCTIONCODE = B.CONSTRUCTIONCODE");
+                strSQL.Append(" WHERE");
+                strSQL.AppendFormat(" B.GROUPCOUNT IN ({0}, {1})"
+                                    , (int)FrmConstructionLedger.DataGroup.Instructor
+                                    , (int)FrmConstructionLedger.DataGroup.Assistant);
+                strSQL.AppendFormat(" AND A.ConstructionPeriod = {0}", TargetYear);
+                strSQL.AppendFormat(" AND A.ConstructionStatusFlg != {0}", NotOrder);
+
+                if (DepartmentCode > 0) strSQL.AppendFormat(" AND C.ComponentCode = {0}", DepartmentCode);
+                if (PersonCode > 0) strSQL.AppendFormat(" AND C.CompanyCode = {0}", PersonCode);
+
+                strSQL.Append(" GROUP BY B.GROUPCOUNT");
+                strSQL.Append(" ORDER BY B.GROUPCOUNT DESC");
+
+                ArrayList arList = new ArrayList();
+                if (!DetailDB.ExecuteReader(strSQL.ToString(), ref arList)) return;
+
+                // å�–å¾—çµ�æžœã‚’æŒ¯ã‚Šåˆ†ã�‘ã‚‹
+                foreach (object[] wrkobj in arList)
+                {
+                    int GrpCode = CommonMotions.cnvInt(wrkobj[0]);
+                    int nValue = CommonMotions.cnvInt(wrkobj[1]);
+                    switch (GrpCode)
+                    {
+                        case (int)FrmConstructionLedger.DataGroup.Assistant:
+                            CostValue[0] = nValue;
+                            break;
+                        case (int)FrmConstructionLedger.DataGroup.Instructor:
+                            CostValue[1] = nValue;
+                            break;
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                logger.ErrorFormat("ã‚·ã‚¹ãƒ†ãƒ ã‚¨ãƒ©ãƒ¼ï¼š{0}ï¼š{1}", CommonMotions.GetMethodName(), ex.Message);
+            }
+            finally
+            {
+                DetailDB.close(); DetailDB = null;
+            }
+        }
+        #endregion
+
+        #region æ‹…å½“è€…æ¯Žã�®éƒ¨ç½²å¤–è£œåŠ©æŒ¯åˆ†ã‚’å�–å¾—ã�™ã‚‹
+        /// <summary>
+        /// æ‹…å½“è€…æ¯Žã�®éƒ¨ç½²å¤–è£œåŠ©æŒ¯åˆ†ã‚’å�–å¾—ã�™ã‚‹
+        /// </summary>
+        public static void GetPersonOuterCostValue(int TargetYear, int DepartmentCode, ref ArrayList CostValue)
+        {
+            IOConstructionLedgerDetail DetailDB = new IOConstructionLedgerDetail();
+            try
+            {
+                int NotOrder = CommonDefine.ProjectsStatus.First(x => x.Value.Equals("é�ž å�— æ³¨")).Key;
+
+                // å·¥äº‹è©³ç´°å�°å¸³ãƒ‡ãƒ¼ã‚¿ã‚ˆã‚Šè©²å½“éƒ¨ç½²ã�®å·¥äº‹ã�§ä»–éƒ¨ç½²ã�‹ã‚‰ã�®è£œåŠ©æŒ¯åˆ†ã‚’å�–å¾—ã�™ã‚‹
+                StringBuilder strSQL = new StringBuilder();
+                strSQL.Append("SELECT");
+                strSQL.Append(" -1");
+                strSQL.Append(", A.GROUPCOUNT");
+                strSQL.Append(", SUM(A.PAYMENTAMOUNT)");
+                strSQL.Append(" FROM");
+                strSQL.Append(" CONSTRUCTIONLEDGEREXCUTE AS A");
+                strSQL.Append(" Inner Join constructionledgerdetail AS B");
+                strSQL.Append("       On B.ConstructionCode = A.ConstructionCode");
+                strSQL.Append("       And B.GroupCount = A.GroupCount");
+                strSQL.Append("       And B.LineCount = A.LineCount");
+                strSQL.Append(" Inner Join constructionbaseinfo AS C");
+                strSQL.Append("       On C.ConstructionCode = B.ConstructionCode");
+                strSQL.AppendFormat(" AND C.ConstructionPeriod = {0}", TargetYear);
+                strSQL.AppendFormat(" AND C.ConstructionStatusFlg != {0}", NotOrder);
+                strSQL.AppendFormat(" AND C.ConstrDepCode = {0}", DepartmentCode);
+                strSQL.Append(" WHERE");
+                strSQL.AppendFormat(" A.GroupCount IN({0}, {1}, {2})", (int)FrmConstructionLedger.DataGroup.Instructor
+                                                                        , (int)FrmConstructionLedger.DataGroup.Assistant
+                                                                        , (int)FrmConstructionLedger.DataGroup.Payroll);
+                strSQL.AppendFormat(" AND B.ComponentCode != {0}", DepartmentCode);
+                strSQL.Append(" Group by A.GROUPCOUNT");
+
+                // å·¥äº‹è©³ç´°å�°å¸³ãƒ‡ãƒ¼ã‚¿ã‚ˆã‚Šä»–éƒ¨ç½²ã�®å·¥äº‹ã�§è©²å½“éƒ¨ç½²ã�®è£œåŠ©æŒ¯åˆ†ã‚’å�–å¾—ã�™ã‚‹
+                strSQL.Append(" UNION SELECT");
+                strSQL.Append(" 1");
+                strSQL.Append(", A.GROUPCOUNT");
+                strSQL.Append(", SUM(A.PAYMENTAMOUNT)");
+                strSQL.Append(" FROM");
+                strSQL.Append(" CONSTRUCTIONLEDGEREXCUTE AS A");
+                strSQL.Append(" Inner Join constructionledgerdetail AS B");
+                strSQL.Append("       On B.ConstructionCode = A.ConstructionCode");
+                strSQL.Append("       And B.GroupCount = A.GroupCount");
+                strSQL.Append("       And B.LineCount = A.LineCount");
+                strSQL.Append(" Inner Join constructionbaseinfo AS C");
+                strSQL.Append("       On C.ConstructionCode = B.ConstructionCode");
+                strSQL.AppendFormat(" AND C.ConstructionPeriod = {0}", TargetYear);
+                strSQL.AppendFormat(" AND C.ConstructionStatusFlg != {0}", NotOrder);
+                strSQL.AppendFormat(" AND C.ConstrDepCode != {0}", DepartmentCode);
+                strSQL.Append(" WHERE");
+                strSQL.AppendFormat(" A.GroupCount IN({0}, {1}, {2})", (int)FrmConstructionLedger.DataGroup.Instructor
+                                                                        , (int)FrmConstructionLedger.DataGroup.Assistant
+                                                                        , (int)FrmConstructionLedger.DataGroup.Payroll);
+                strSQL.AppendFormat(" AND B.ComponentCode = {0}", DepartmentCode);
+                strSQL.Append(" Group by A.GROUPCOUNT");
+
+                if (!DetailDB.ExecuteReader(strSQL.ToString(), ref CostValue)) return;
+
+            }
+            catch (Exception ex)
+            {
+                logger.ErrorFormat("ã‚·ã‚¹ãƒ†ãƒ ã‚¨ãƒ©ãƒ¼ï¼š{0}ï¼š{1}", CommonMotions.GetMethodName(), ex.Message);
+            }
+            finally
+            {
+                DetailDB.close(); DetailDB = null;
+            }
+        }
+        #endregion
+    }
+}
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedgerList/FrmConstructionLedgerList.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedgerList/FrmConstructionLedgerList.cs	(revision 343)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedgerList/FrmConstructionLedgerList.cs	(revision 344)
@@ -615,10 +615,9 @@
         {
             if (m_initDataLoad) return;
 
-            // •”��ƒRƒ“ƒ{ƒ{ƒbƒNƒX•Ï�X
-            SetcmbDepartment();
-            // ’S“–ŽÒƒRƒ“ƒ{ƒ{ƒbƒNƒX•Ï�X
-            SetcmbPersons();
+            // ‰æ–ÊƒNƒŠƒA
+            ClearDisplay();
+
             // ’S“–ŽÒƒRƒ“ƒ{ƒ{ƒbƒNƒXƒZƒbƒgŽž•”��‚ðƒZƒbƒg‚·‚é
             if (!SetPerosonToDepartment()) return;
 
@@ -637,6 +636,9 @@
         {
             if (m_initDataLoad) return;
 
+            // ‰æ–ÊƒNƒŠƒA
+            ClearDisplay();
+
             // ’S“–ŽÒƒRƒ“ƒ{ƒ{ƒbƒNƒX•Ï�X
             SetcmbPersons();
 
@@ -655,6 +657,9 @@
         {
             if (m_initDataLoad) return;
 
+            // ‰æ–ÊƒNƒŠƒA
+            ClearDisplay();
+
             // ’S“–ŽÒƒRƒ“ƒ{ƒ{ƒbƒNƒXƒZƒbƒgŽž•”��‚ðƒZƒbƒg‚·‚é
             if (!SetPerosonToDepartment()) return;
 
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedgerList/FrmConstructionLedgerList.designer.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedgerList/FrmConstructionLedgerList.designer.cs	(revision 343)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedgerList/FrmConstructionLedgerList.designer.cs	(revision 344)
@@ -28,24 +28,24 @@
         /// </summary>
         private void InitializeComponent()
         {
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle();
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle19 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle20 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle36 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle21 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle22 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle23 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle24 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle25 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle26 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle27 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle28 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle29 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle30 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle31 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle32 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle33 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle34 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle35 = new System.Windows.Forms.DataGridViewCellStyle();
             this.btnEnd = new System.Windows.Forms.Button();
             this.label1 = new System.Windows.Forms.Label();
             this.lblCellTotal = new System.Windows.Forms.Label();
@@ -70,35 +70,35 @@
             this.Column12 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.groupBox1 = new ProcessManagement.Forms.CustomControls.GroupBoxEx();
             this.pnlPayroll = new System.Windows.Forms.Panel();
-            this.label18 = new System.Windows.Forms.Label();
-            this.lblEndDate = new System.Windows.Forms.Label();
-            this.lblStartDate = new System.Windows.Forms.Label();
+            this.label6 = new System.Windows.Forms.Label();
             this.label8 = new System.Windows.Forms.Label();
-            this.label6 = new System.Windows.Forms.Label();
-            this.lblTotalCalcValue2 = new System.Windows.Forms.Label();
-            this.label23 = new System.Windows.Forms.Label();
+            this.label9 = new System.Windows.Forms.Label();
+            this.label10 = new System.Windows.Forms.Label();
             this.label11 = new System.Windows.Forms.Label();
-            this.lblTotalCalcValue1 = new System.Windows.Forms.Label();
+            this.label12 = new System.Windows.Forms.Label();
+            this.label13 = new System.Windows.Forms.Label();
+            this.label14 = new System.Windows.Forms.Label();
+            this.label15 = new System.Windows.Forms.Label();
+            this.label16 = new System.Windows.Forms.Label();
+            this.label17 = new System.Windows.Forms.Label();
+            this.label18 = new System.Windows.Forms.Label();
             this.label19 = new System.Windows.Forms.Label();
-            this.lblPlusorMinus2 = new System.Windows.Forms.Label();
-            this.label16 = new System.Windows.Forms.Label();
-            this.lblPlusorMinus1 = new System.Windows.Forms.Label();
+            this.label20 = new System.Windows.Forms.Label();
+            this.label22 = new System.Windows.Forms.Label();
+            this.label23 = new System.Windows.Forms.Label();
+            this.lblStartDate = new System.Windows.Forms.Label();
+            this.lblEndDate = new System.Windows.Forms.Label();
             this.lblTotalCalcValue = new System.Windows.Forms.Label();
-            this.label12 = new System.Windows.Forms.Label();
-            this.label22 = new System.Windows.Forms.Label();
-            this.lblTotalValue2 = new System.Windows.Forms.Label();
-            this.label14 = new System.Windows.Forms.Label();
+            this.lblTotalCalcValue1 = new System.Windows.Forms.Label();
+            this.lblTotalCalcValue2 = new System.Windows.Forms.Label();
+            this.label24 = new System.Windows.Forms.Label();
+            this.label25 = new System.Windows.Forms.Label();
+            this.lblCalcValue1 = new System.Windows.Forms.Label();
             this.lblCalcValue2 = new System.Windows.Forms.Label();
-            this.label20 = new System.Windows.Forms.Label();
-            this.label13 = new System.Windows.Forms.Label();
             this.lblCalcValue3 = new System.Windows.Forms.Label();
             this.lblTotalValue = new System.Windows.Forms.Label();
-            this.label17 = new System.Windows.Forms.Label();
-            this.label9 = new System.Windows.Forms.Label();
+            this.lblTotalValue2 = new System.Windows.Forms.Label();
             this.lblPayroll = new System.Windows.Forms.Label();
-            this.label15 = new System.Windows.Forms.Label();
-            this.lblCalcValue1 = new System.Windows.Forms.Label();
-            this.label10 = new System.Windows.Forms.Label();
             this.cmbDepartment = new System.Windows.Forms.ComboBox();
             this.label2 = new System.Windows.Forms.Label();
             this.label4 = new System.Windows.Forms.Label();
@@ -194,21 +194,21 @@
             this.dgvMaster.AllowUserToDeleteRows = false;
             this.dgvMaster.AllowUserToResizeColumns = false;
             this.dgvMaster.AllowUserToResizeRows = false;
-            dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
-            this.dgvMaster.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
+            dataGridViewCellStyle19.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
+            this.dgvMaster.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle19;
             this.dgvMaster.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
             | System.Windows.Forms.AnchorStyles.Left) 
             | System.Windows.Forms.AnchorStyles.Right)));
             this.dgvMaster.BackgroundColor = System.Drawing.Color.White;
             this.dgvMaster.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
-            dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
-            dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
-            dataGridViewCellStyle2.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
-            dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
-            dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
-            dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
-            dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
-            this.dgvMaster.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
+            dataGridViewCellStyle20.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+            dataGridViewCellStyle20.BackColor = System.Drawing.SystemColors.Control;
+            dataGridViewCellStyle20.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+            dataGridViewCellStyle20.ForeColor = System.Drawing.SystemColors.WindowText;
+            dataGridViewCellStyle20.SelectionBackColor = System.Drawing.SystemColors.Highlight;
+            dataGridViewCellStyle20.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
+            dataGridViewCellStyle20.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
+            this.dgvMaster.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle20;
             this.dgvMaster.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
             this.dgvMaster.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
             this.Column1,
@@ -226,14 +226,14 @@
             this.Column10,
             this.Column11,
             this.Column12});
-            dataGridViewCellStyle18.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
-            dataGridViewCellStyle18.BackColor = System.Drawing.SystemColors.Window;
-            dataGridViewCellStyle18.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
-            dataGridViewCellStyle18.ForeColor = System.Drawing.SystemColors.ControlText;
-            dataGridViewCellStyle18.SelectionBackColor = System.Drawing.Color.LightSeaGreen;
-            dataGridViewCellStyle18.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
-            dataGridViewCellStyle18.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
-            this.dgvMaster.DefaultCellStyle = dataGridViewCellStyle18;
+            dataGridViewCellStyle36.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
+            dataGridViewCellStyle36.BackColor = System.Drawing.SystemColors.Window;
+            dataGridViewCellStyle36.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+            dataGridViewCellStyle36.ForeColor = System.Drawing.SystemColors.ControlText;
+            dataGridViewCellStyle36.SelectionBackColor = System.Drawing.Color.LightSeaGreen;
+            dataGridViewCellStyle36.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
+            dataGridViewCellStyle36.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
+            this.dgvMaster.DefaultCellStyle = dataGridViewCellStyle36;
             this.dgvMaster.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter;
             this.dgvMaster.EnableHeadersVisualStyles = false;
             this.dgvMaster.Location = new System.Drawing.Point(5, 168);
@@ -252,8 +252,8 @@
             // 
             // Column1
             // 
-            dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
-            this.Column1.DefaultCellStyle = dataGridViewCellStyle3;
+            dataGridViewCellStyle21.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+            this.Column1.DefaultCellStyle = dataGridViewCellStyle21;
             this.Column1.Frozen = true;
             this.Column1.HeaderText = "â„–";
             this.Column1.Name = "Column1";
@@ -264,8 +264,8 @@
             // 
             // Column13
             // 
-            dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
-            this.Column13.DefaultCellStyle = dataGridViewCellStyle4;
+            dataGridViewCellStyle22.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+            this.Column13.DefaultCellStyle = dataGridViewCellStyle22;
             this.Column13.Frozen = true;
             this.Column13.HeaderText = "æ¸ˆ";
             this.Column13.Name = "Column13";
@@ -275,8 +275,8 @@
             // 
             // Column14
             // 
-            dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
-            this.Column14.DefaultCellStyle = dataGridViewCellStyle5;
+            dataGridViewCellStyle23.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+            this.Column14.DefaultCellStyle = dataGridViewCellStyle23;
             this.Column14.Frozen = true;
             this.Column14.HeaderText = "éƒ¨ç½²";
             this.Column14.Name = "Column14";
@@ -284,8 +284,8 @@
             // 
             // Column2
             // 
-            dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
-            this.Column2.DefaultCellStyle = dataGridViewCellStyle6;
+            dataGridViewCellStyle24.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+            this.Column2.DefaultCellStyle = dataGridViewCellStyle24;
             this.Column2.Frozen = true;
             this.Column2.HeaderText = "æ‹…å½“è€…å��";
             this.Column2.Name = "Column2";
@@ -295,8 +295,8 @@
             // 
             // Column3
             // 
-            dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
-            this.Column3.DefaultCellStyle = dataGridViewCellStyle7;
+            dataGridViewCellStyle25.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+            this.Column3.DefaultCellStyle = dataGridViewCellStyle25;
             this.Column3.Frozen = true;
             this.Column3.HeaderText = "å·¥äº‹ã‚³ãƒ¼ãƒ‰";
             this.Column3.Name = "Column3";
@@ -308,8 +308,8 @@
             // 
             // Column4
             // 
-            dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
-            this.Column4.DefaultCellStyle = dataGridViewCellStyle8;
+            dataGridViewCellStyle26.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
+            this.Column4.DefaultCellStyle = dataGridViewCellStyle26;
             this.Column4.Frozen = true;
             this.Column4.HeaderText = "å·¥ã€€äº‹ã€€å��ã€€ç§°";
             this.Column4.Name = "Column4";
@@ -320,9 +320,9 @@
             // 
             // Column15
             // 
-            dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
-            dataGridViewCellStyle9.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
-            this.Column15.DefaultCellStyle = dataGridViewCellStyle9;
+            dataGridViewCellStyle27.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+            dataGridViewCellStyle27.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+            this.Column15.DefaultCellStyle = dataGridViewCellStyle27;
             this.Column15.Frozen = true;
             this.Column15.HeaderText = "çŠ¶ã€€æ…‹";
             this.Column15.Name = "Column15";
@@ -331,9 +331,9 @@
             // 
             // Column5
             // 
-            dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
-            dataGridViewCellStyle10.Font = new System.Drawing.Font("ï¼­ï¼³ ï¼°æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
-            this.Column5.DefaultCellStyle = dataGridViewCellStyle10;
+            dataGridViewCellStyle28.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
+            dataGridViewCellStyle28.Font = new System.Drawing.Font("ï¼­ï¼³ ï¼°æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+            this.Column5.DefaultCellStyle = dataGridViewCellStyle28;
             this.Column5.Frozen = true;
             this.Column5.HeaderText = "å�—æ³¨é‡‘é¡�";
             this.Column5.Name = "Column5";
@@ -344,9 +344,9 @@
             // 
             // Column6
             // 
-            dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
-            dataGridViewCellStyle11.Font = new System.Drawing.Font("ï¼­ï¼³ ï¼°æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold);
-            this.Column6.DefaultCellStyle = dataGridViewCellStyle11;
+            dataGridViewCellStyle29.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
+            dataGridViewCellStyle29.Font = new System.Drawing.Font("ï¼­ï¼³ ï¼°æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold);
+            this.Column6.DefaultCellStyle = dataGridViewCellStyle29;
             this.Column6.HeaderText = "ä¼šç¤¾çµŒè²»";
             this.Column6.Name = "Column6";
             this.Column6.ReadOnly = true;
@@ -355,9 +355,9 @@
             // 
             // Column7
             // 
-            dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
-            dataGridViewCellStyle12.Font = new System.Drawing.Font("ï¼­ï¼³ ï¼°æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold);
-            this.Column7.DefaultCellStyle = dataGridViewCellStyle12;
+            dataGridViewCellStyle30.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
+            dataGridViewCellStyle30.Font = new System.Drawing.Font("ï¼­ï¼³ ï¼°æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold);
+            this.Column7.DefaultCellStyle = dataGridViewCellStyle30;
             this.Column7.HeaderText = "éƒ¨ç½²çµŒè²»";
             this.Column7.Name = "Column7";
             this.Column7.ReadOnly = true;
@@ -366,9 +366,9 @@
             // 
             // Column8
             // 
-            dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
-            dataGridViewCellStyle13.Font = new System.Drawing.Font("ï¼­ï¼³ ï¼°æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold);
-            this.Column8.DefaultCellStyle = dataGridViewCellStyle13;
+            dataGridViewCellStyle31.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
+            dataGridViewCellStyle31.Font = new System.Drawing.Font("ï¼­ï¼³ ï¼°æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold);
+            this.Column8.DefaultCellStyle = dataGridViewCellStyle31;
             this.Column8.HeaderText = "å–¶æ¥­çµŒè²»";
             this.Column8.Name = "Column8";
             this.Column8.ReadOnly = true;
@@ -377,9 +377,9 @@
             // 
             // Column9
             // 
-            dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
-            dataGridViewCellStyle14.Font = new System.Drawing.Font("ï¼­ï¼³ ï¼°æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold);
-            this.Column9.DefaultCellStyle = dataGridViewCellStyle14;
+            dataGridViewCellStyle32.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
+            dataGridViewCellStyle32.Font = new System.Drawing.Font("ï¼­ï¼³ ï¼°æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold);
+            this.Column9.DefaultCellStyle = dataGridViewCellStyle32;
             this.Column9.HeaderText = "ç·�æ”¯æ‰•é¡�";
             this.Column9.Name = "Column9";
             this.Column9.ReadOnly = true;
@@ -388,9 +388,9 @@
             // 
             // Column10
             // 
-            dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
-            dataGridViewCellStyle15.Font = new System.Drawing.Font("ï¼­ï¼³ ï¼°æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold);
-            this.Column10.DefaultCellStyle = dataGridViewCellStyle15;
+            dataGridViewCellStyle33.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
+            dataGridViewCellStyle33.Font = new System.Drawing.Font("ï¼­ï¼³ ï¼°æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold);
+            this.Column10.DefaultCellStyle = dataGridViewCellStyle33;
             this.Column10.HeaderText = "ç²—ã€€åˆ©";
             this.Column10.Name = "Column10";
             this.Column10.ReadOnly = true;
@@ -399,9 +399,9 @@
             // 
             // Column11
             // 
-            dataGridViewCellStyle16.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
-            dataGridViewCellStyle16.Font = new System.Drawing.Font("ï¼­ï¼³ ï¼°æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold);
-            this.Column11.DefaultCellStyle = dataGridViewCellStyle16;
+            dataGridViewCellStyle34.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
+            dataGridViewCellStyle34.Font = new System.Drawing.Font("ï¼­ï¼³ ï¼°æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold);
+            this.Column11.DefaultCellStyle = dataGridViewCellStyle34;
             this.Column11.HeaderText = "çµ¦ã€€ä¸Ž";
             this.Column11.Name = "Column11";
             this.Column11.ReadOnly = true;
@@ -412,9 +412,9 @@
             // 
             // Column12
             // 
-            dataGridViewCellStyle17.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
-            dataGridViewCellStyle17.Font = new System.Drawing.Font("ï¼­ï¼³ ï¼°æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold);
-            this.Column12.DefaultCellStyle = dataGridViewCellStyle17;
+            dataGridViewCellStyle35.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
+            dataGridViewCellStyle35.Font = new System.Drawing.Font("ï¼­ï¼³ ï¼°æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold);
+            this.Column12.DefaultCellStyle = dataGridViewCellStyle35;
             this.Column12.HeaderText = "ç´”åˆ©ç›Š";
             this.Column12.Name = "Column12";
             this.Column12.ReadOnly = true;
@@ -446,76 +446,53 @@
             // 
             this.pnlPayroll.BackColor = System.Drawing.Color.PaleGoldenrod;
             this.pnlPayroll.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
-            this.pnlPayroll.Controls.Add(this.label18);
-            this.pnlPayroll.Controls.Add(this.lblEndDate);
-            this.pnlPayroll.Controls.Add(this.lblStartDate);
+            this.pnlPayroll.Controls.Add(this.label6);
             this.pnlPayroll.Controls.Add(this.label8);
-            this.pnlPayroll.Controls.Add(this.label6);
-            this.pnlPayroll.Controls.Add(this.lblTotalCalcValue2);
-            this.pnlPayroll.Controls.Add(this.label23);
+            this.pnlPayroll.Controls.Add(this.label9);
+            this.pnlPayroll.Controls.Add(this.label10);
             this.pnlPayroll.Controls.Add(this.label11);
-            this.pnlPayroll.Controls.Add(this.lblTotalCalcValue1);
+            this.pnlPayroll.Controls.Add(this.label12);
+            this.pnlPayroll.Controls.Add(this.label13);
+            this.pnlPayroll.Controls.Add(this.label14);
+            this.pnlPayroll.Controls.Add(this.label15);
+            this.pnlPayroll.Controls.Add(this.label16);
+            this.pnlPayroll.Controls.Add(this.label17);
+            this.pnlPayroll.Controls.Add(this.label18);
             this.pnlPayroll.Controls.Add(this.label19);
-            this.pnlPayroll.Controls.Add(this.lblPlusorMinus2);
-            this.pnlPayroll.Controls.Add(this.label16);
-            this.pnlPayroll.Controls.Add(this.lblPlusorMinus1);
+            this.pnlPayroll.Controls.Add(this.label20);
+            this.pnlPayroll.Controls.Add(this.label22);
+            this.pnlPayroll.Controls.Add(this.label23);
+            this.pnlPayroll.Controls.Add(this.label24);
+            this.pnlPayroll.Controls.Add(this.label25);
+            this.pnlPayroll.Controls.Add(this.lblStartDate);
+            this.pnlPayroll.Controls.Add(this.lblEndDate);
             this.pnlPayroll.Controls.Add(this.lblTotalCalcValue);
-            this.pnlPayroll.Controls.Add(this.label12);
-            this.pnlPayroll.Controls.Add(this.label22);
-            this.pnlPayroll.Controls.Add(this.lblTotalValue2);
-            this.pnlPayroll.Controls.Add(this.label14);
+            this.pnlPayroll.Controls.Add(this.lblTotalCalcValue1);
+            this.pnlPayroll.Controls.Add(this.lblTotalCalcValue2);
+            this.pnlPayroll.Controls.Add(this.lblCalcValue1);
             this.pnlPayroll.Controls.Add(this.lblCalcValue2);
-            this.pnlPayroll.Controls.Add(this.label20);
-            this.pnlPayroll.Controls.Add(this.label13);
             this.pnlPayroll.Controls.Add(this.lblCalcValue3);
             this.pnlPayroll.Controls.Add(this.lblTotalValue);
-            this.pnlPayroll.Controls.Add(this.label17);
-            this.pnlPayroll.Controls.Add(this.label9);
+            this.pnlPayroll.Controls.Add(this.lblTotalValue2);
             this.pnlPayroll.Controls.Add(this.lblPayroll);
-            this.pnlPayroll.Controls.Add(this.label15);
-            this.pnlPayroll.Controls.Add(this.lblCalcValue1);
-            this.pnlPayroll.Controls.Add(this.label10);
             this.pnlPayroll.Location = new System.Drawing.Point(6, 36);
             this.pnlPayroll.Name = "pnlPayroll";
             this.pnlPayroll.Size = new System.Drawing.Size(1320, 84);
             this.pnlPayroll.TabIndex = 47;
             // 
-            // label18
+            // label6
             // 
-            this.label18.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
-            this.label18.AutoSize = true;
-            this.label18.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
-            this.label18.ForeColor = System.Drawing.Color.Red;
-            this.label18.Location = new System.Drawing.Point(944, 59);
-            this.label18.Name = "label18";
-            this.label18.Size = new System.Drawing.Size(345, 19);
-            this.label18.TabIndex = 55;
-            this.label18.Text = "â€»å½“æœŸäººä»¶è²»ã�®ã�Šã�Šã‚ˆã��ã�®è¨ˆç®—ã�§ã�™";
+            this.label6.BackColor = System.Drawing.Color.Ivory;
+            this.label6.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
+            this.label6.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+            this.label6.ForeColor = System.Drawing.Color.Black;
+            this.label6.Location = new System.Drawing.Point(994, 3);
+            this.label6.Name = "label6";
+            this.label6.Size = new System.Drawing.Size(110, 25);
+            this.label6.TabIndex = 53;
+            this.label6.Text = "çµ¦ä¸Žè¨ˆç®—é–‹å§‹æ—¥";
+            this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
             // 
-            // lblEndDate
-            // 
-            this.lblEndDate.BackColor = System.Drawing.Color.White;
-            this.lblEndDate.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
-            this.lblEndDate.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
-            this.lblEndDate.ForeColor = System.Drawing.Color.Black;
-            this.lblEndDate.Location = new System.Drawing.Point(1104, 28);
-            this.lblEndDate.Name = "lblEndDate";
-            this.lblEndDate.Size = new System.Drawing.Size(140, 25);
-            this.lblEndDate.TabIndex = 54;
-            this.lblEndDate.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
-            // 
-            // lblStartDate
-            // 
-            this.lblStartDate.BackColor = System.Drawing.Color.White;
-            this.lblStartDate.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
-            this.lblStartDate.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
-            this.lblStartDate.ForeColor = System.Drawing.Color.Black;
-            this.lblStartDate.Location = new System.Drawing.Point(1104, 3);
-            this.lblStartDate.Name = "lblStartDate";
-            this.lblStartDate.Size = new System.Drawing.Size(140, 25);
-            this.lblStartDate.TabIndex = 54;
-            this.lblStartDate.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
-            // 
             // label8
             // 
             this.label8.BackColor = System.Drawing.Color.Ivory;
@@ -529,44 +506,32 @@
             this.label8.Text = "çµ¦ä¸Žè¨ˆç®—çµ‚äº†æ—¥";
             this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
             // 
-            // label6
+            // label9
             // 
-            this.label6.BackColor = System.Drawing.Color.Ivory;
-            this.label6.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
-            this.label6.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
-            this.label6.ForeColor = System.Drawing.Color.Black;
-            this.label6.Location = new System.Drawing.Point(994, 3);
-            this.label6.Name = "label6";
-            this.label6.Size = new System.Drawing.Size(110, 25);
-            this.label6.TabIndex = 53;
-            this.label6.Text = "çµ¦ä¸Žè¨ˆç®—é–‹å§‹æ—¥";
-            this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+            this.label9.BackColor = System.Drawing.Color.Black;
+            this.label9.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
+            this.label9.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+            this.label9.ForeColor = System.Drawing.Color.White;
+            this.label9.Location = new System.Drawing.Point(379, 3);
+            this.label9.Name = "label9";
+            this.label9.Size = new System.Drawing.Size(110, 25);
+            this.label9.TabIndex = 0;
+            this.label9.Text = "å½“æœŸäºˆæ¸¬çµ¦ä¸Ž";
+            this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
             // 
-            // lblTotalCalcValue2
+            // label10
             // 
-            this.lblTotalCalcValue2.BackColor = System.Drawing.Color.White;
-            this.lblTotalCalcValue2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
-            this.lblTotalCalcValue2.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
-            this.lblTotalCalcValue2.ForeColor = System.Drawing.Color.Black;
-            this.lblTotalCalcValue2.Location = new System.Drawing.Point(489, 53);
-            this.lblTotalCalcValue2.Name = "lblTotalCalcValue2";
-            this.lblTotalCalcValue2.Size = new System.Drawing.Size(140, 25);
-            this.lblTotalCalcValue2.TabIndex = 52;
-            this.lblTotalCalcValue2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+            this.label10.BackColor = System.Drawing.Color.Blue;
+            this.label10.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
+            this.label10.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+            this.label10.ForeColor = System.Drawing.Color.White;
+            this.label10.Location = new System.Drawing.Point(72, 3);
+            this.label10.Name = "label10";
+            this.label10.Size = new System.Drawing.Size(110, 25);
+            this.label10.TabIndex = 0;
+            this.label10.Text = "æŒ¯åˆ†æ¸ˆçµ¦ä¸Ž";
+            this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
             // 
-            // label23
-            // 
-            this.label23.BackColor = System.Drawing.Color.Orange;
-            this.label23.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
-            this.label23.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
-            this.label23.ForeColor = System.Drawing.Color.White;
-            this.label23.Location = new System.Drawing.Point(379, 53);
-            this.label23.Name = "label23";
-            this.label23.Size = new System.Drawing.Size(110, 25);
-            this.label23.TabIndex = 51;
-            this.label23.Text = "æ‹…å½“å¤–å�Žç›Š";
-            this.label23.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
-            // 
             // label11
             // 
             this.label11.AutoSize = true;
@@ -580,44 +545,58 @@
             this.label11.Text = "ï¼�";
             this.label11.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
             // 
-            // lblTotalCalcValue1
+            // label12
             // 
-            this.lblTotalCalcValue1.BackColor = System.Drawing.Color.White;
-            this.lblTotalCalcValue1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
-            this.lblTotalCalcValue1.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
-            this.lblTotalCalcValue1.ForeColor = System.Drawing.Color.Black;
-            this.lblTotalCalcValue1.Location = new System.Drawing.Point(796, 28);
-            this.lblTotalCalcValue1.Name = "lblTotalCalcValue1";
-            this.lblTotalCalcValue1.Size = new System.Drawing.Size(140, 25);
-            this.lblTotalCalcValue1.TabIndex = 50;
-            this.lblTotalCalcValue1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+            this.label12.AutoSize = true;
+            this.label12.BackColor = System.Drawing.Color.PaleGoldenrod;
+            this.label12.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+            this.label12.ForeColor = System.Drawing.Color.Black;
+            this.label12.Location = new System.Drawing.Point(338, 7);
+            this.label12.Name = "label12";
+            this.label12.Size = new System.Drawing.Size(25, 16);
+            this.label12.TabIndex = 2;
+            this.label12.Text = "ï¼�";
+            this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
             // 
-            // label19
+            // label13
             // 
-            this.label19.BackColor = System.Drawing.Color.Orange;
-            this.label19.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
-            this.label19.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
-            this.label19.ForeColor = System.Drawing.Color.White;
-            this.label19.Location = new System.Drawing.Point(686, 28);
-            this.label19.Name = "label19";
-            this.label19.Size = new System.Drawing.Size(110, 25);
-            this.label19.TabIndex = 49;
-            this.label19.Text = "æ‹…å½“å¤–å�Žç›Š";
-            this.label19.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+            this.label13.AutoSize = true;
+            this.label13.BackColor = System.Drawing.Color.PaleGoldenrod;
+            this.label13.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+            this.label13.ForeColor = System.Drawing.Color.Black;
+            this.label13.Location = new System.Drawing.Point(645, 7);
+            this.label13.Name = "label13";
+            this.label13.Size = new System.Drawing.Size(25, 16);
+            this.label13.TabIndex = 3;
+            this.label13.Text = "ï¼�";
+            this.label13.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
             // 
-            // lblPlusorMinus2
+            // label14
             // 
-            this.lblPlusorMinus2.AutoSize = true;
-            this.lblPlusorMinus2.BackColor = System.Drawing.Color.PaleGoldenrod;
-            this.lblPlusorMinus2.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
-            this.lblPlusorMinus2.ForeColor = System.Drawing.Color.Black;
-            this.lblPlusorMinus2.Location = new System.Drawing.Point(338, 59);
-            this.lblPlusorMinus2.Name = "lblPlusorMinus2";
-            this.lblPlusorMinus2.Size = new System.Drawing.Size(25, 16);
-            this.lblPlusorMinus2.TabIndex = 47;
-            this.lblPlusorMinus2.Text = "ï¼‹";
-            this.lblPlusorMinus2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+            this.label14.BackColor = System.Drawing.Color.DarkSeaGreen;
+            this.label14.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
+            this.label14.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+            this.label14.ForeColor = System.Drawing.Color.DarkRed;
+            this.label14.Location = new System.Drawing.Point(72, 53);
+            this.label14.Name = "label14";
+            this.label14.Size = new System.Drawing.Size(110, 25);
+            this.label14.TabIndex = 32;
+            this.label14.Text = "çµŒé�Žçµ¦ä¸Žå·®é¡�";
+            this.label14.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
             // 
+            // label15
+            // 
+            this.label15.BackColor = System.Drawing.Color.DarkSeaGreen;
+            this.label15.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
+            this.label15.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+            this.label15.ForeColor = System.Drawing.Color.DarkRed;
+            this.label15.Location = new System.Drawing.Point(686, 3);
+            this.label15.Name = "label15";
+            this.label15.Size = new System.Drawing.Size(110, 25);
+            this.label15.TabIndex = 4;
+            this.label15.Text = "çµŒé�Žçµ¦ä¸Žå·®é¡�";
+            this.label15.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+            // 
             // label16
             // 
             this.label16.AutoSize = true;
@@ -631,44 +610,57 @@
             this.label16.Text = "ï¼�";
             this.label16.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
             // 
-            // lblPlusorMinus1
+            // label17
             // 
-            this.lblPlusorMinus1.AutoSize = true;
-            this.lblPlusorMinus1.BackColor = System.Drawing.Color.PaleGoldenrod;
-            this.lblPlusorMinus1.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
-            this.lblPlusorMinus1.ForeColor = System.Drawing.Color.Black;
-            this.lblPlusorMinus1.Location = new System.Drawing.Point(338, 34);
-            this.lblPlusorMinus1.Name = "lblPlusorMinus1";
-            this.lblPlusorMinus1.Size = new System.Drawing.Size(25, 16);
-            this.lblPlusorMinus1.TabIndex = 31;
-            this.lblPlusorMinus1.Text = "ï¼‹";
-            this.lblPlusorMinus1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+            this.label17.BackColor = System.Drawing.Color.OldLace;
+            this.label17.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
+            this.label17.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+            this.label17.ForeColor = System.Drawing.Color.Black;
+            this.label17.Location = new System.Drawing.Point(379, 28);
+            this.label17.Name = "label17";
+            this.label17.Size = new System.Drawing.Size(110, 25);
+            this.label17.TabIndex = 6;
+            this.label17.Text = "æŒ‡å°Žå“¡å�Žç›Š";
+            this.label17.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
             // 
-            // lblTotalCalcValue
+            // label18
             // 
-            this.lblTotalCalcValue.BackColor = System.Drawing.Color.White;
-            this.lblTotalCalcValue.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
-            this.lblTotalCalcValue.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
-            this.lblTotalCalcValue.ForeColor = System.Drawing.Color.Black;
-            this.lblTotalCalcValue.Location = new System.Drawing.Point(796, 53);
-            this.lblTotalCalcValue.Name = "lblTotalCalcValue";
-            this.lblTotalCalcValue.Size = new System.Drawing.Size(140, 25);
-            this.lblTotalCalcValue.TabIndex = 33;
-            this.lblTotalCalcValue.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+            this.label18.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+            this.label18.AutoSize = true;
+            this.label18.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+            this.label18.ForeColor = System.Drawing.Color.Red;
+            this.label18.Location = new System.Drawing.Point(944, 59);
+            this.label18.Name = "label18";
+            this.label18.Size = new System.Drawing.Size(345, 19);
+            this.label18.TabIndex = 55;
+            this.label18.Text = "â€»å½“æœŸäººä»¶è²»ã�®ã�Šã�Šã‚ˆã��ã�®è¨ˆç®—ã�§ã�™";
             // 
-            // label12
+            // label19
             // 
-            this.label12.AutoSize = true;
-            this.label12.BackColor = System.Drawing.Color.PaleGoldenrod;
-            this.label12.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
-            this.label12.ForeColor = System.Drawing.Color.Black;
-            this.label12.Location = new System.Drawing.Point(338, 7);
-            this.label12.Name = "label12";
-            this.label12.Size = new System.Drawing.Size(25, 16);
-            this.label12.TabIndex = 2;
-            this.label12.Text = "ï¼�";
-            this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+            this.label19.BackColor = System.Drawing.Color.Orange;
+            this.label19.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
+            this.label19.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+            this.label19.ForeColor = System.Drawing.Color.White;
+            this.label19.Location = new System.Drawing.Point(686, 28);
+            this.label19.Name = "label19";
+            this.label19.Size = new System.Drawing.Size(110, 25);
+            this.label19.TabIndex = 49;
+            this.label19.Text = "æ‹…å½“å¤–å�Žç›Š";
+            this.label19.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
             // 
+            // label20
+            // 
+            this.label20.BackColor = System.Drawing.Color.LightGoldenrodYellow;
+            this.label20.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
+            this.label20.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+            this.label20.ForeColor = System.Drawing.Color.Black;
+            this.label20.Location = new System.Drawing.Point(72, 28);
+            this.label20.Name = "label20";
+            this.label20.Size = new System.Drawing.Size(110, 25);
+            this.label20.TabIndex = 11;
+            this.label20.Text = "å‰¯æ‹…å½“å�Žç›Š";
+            this.label20.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+            // 
             // label22
             // 
             this.label22.BackColor = System.Drawing.Color.Navy;
@@ -682,31 +674,118 @@
             this.label22.Text = "å½“æœŸäººä»¶è²»æ��ç›Š";
             this.label22.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
             // 
-            // lblTotalValue2
+            // label23
             // 
-            this.lblTotalValue2.BackColor = System.Drawing.Color.White;
-            this.lblTotalValue2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
-            this.lblTotalValue2.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
-            this.lblTotalValue2.ForeColor = System.Drawing.Color.Black;
-            this.lblTotalValue2.Location = new System.Drawing.Point(489, 28);
-            this.lblTotalValue2.Name = "lblTotalValue2";
-            this.lblTotalValue2.Size = new System.Drawing.Size(140, 25);
-            this.lblTotalValue2.TabIndex = 33;
-            this.lblTotalValue2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+            this.label23.BackColor = System.Drawing.Color.Orange;
+            this.label23.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
+            this.label23.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+            this.label23.ForeColor = System.Drawing.Color.White;
+            this.label23.Location = new System.Drawing.Point(379, 53);
+            this.label23.Name = "label23";
+            this.label23.Size = new System.Drawing.Size(110, 25);
+            this.label23.TabIndex = 51;
+            this.label23.Text = "æ‹…å½“å¤–å�Žç›Š";
+            this.label23.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
             // 
-            // label14
+            // lblStartDate
             // 
-            this.label14.BackColor = System.Drawing.Color.DarkSeaGreen;
-            this.label14.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
-            this.label14.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
-            this.label14.ForeColor = System.Drawing.Color.DarkRed;
-            this.label14.Location = new System.Drawing.Point(72, 53);
-            this.label14.Name = "label14";
-            this.label14.Size = new System.Drawing.Size(110, 25);
-            this.label14.TabIndex = 32;
-            this.label14.Text = "çµŒé�Žçµ¦ä¸Žå·®é¡�";
-            this.label14.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+            this.lblStartDate.BackColor = System.Drawing.Color.White;
+            this.lblStartDate.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
+            this.lblStartDate.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+            this.lblStartDate.ForeColor = System.Drawing.Color.Black;
+            this.lblStartDate.Location = new System.Drawing.Point(1104, 3);
+            this.lblStartDate.Name = "lblStartDate";
+            this.lblStartDate.Size = new System.Drawing.Size(140, 25);
+            this.lblStartDate.TabIndex = 54;
+            this.lblStartDate.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
             // 
+            // lblEndDate
+            // 
+            this.lblEndDate.BackColor = System.Drawing.Color.White;
+            this.lblEndDate.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
+            this.lblEndDate.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+            this.lblEndDate.ForeColor = System.Drawing.Color.Black;
+            this.lblEndDate.Location = new System.Drawing.Point(1104, 28);
+            this.lblEndDate.Name = "lblEndDate";
+            this.lblEndDate.Size = new System.Drawing.Size(140, 25);
+            this.lblEndDate.TabIndex = 54;
+            this.lblEndDate.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+            // 
+            // lblTotalCalcValue
+            // 
+            this.lblTotalCalcValue.BackColor = System.Drawing.Color.White;
+            this.lblTotalCalcValue.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
+            this.lblTotalCalcValue.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+            this.lblTotalCalcValue.ForeColor = System.Drawing.Color.Black;
+            this.lblTotalCalcValue.Location = new System.Drawing.Point(796, 53);
+            this.lblTotalCalcValue.Name = "lblTotalCalcValue";
+            this.lblTotalCalcValue.Size = new System.Drawing.Size(140, 25);
+            this.lblTotalCalcValue.TabIndex = 33;
+            this.lblTotalCalcValue.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+            // 
+            // lblTotalCalcValue1
+            // 
+            this.lblTotalCalcValue1.BackColor = System.Drawing.Color.White;
+            this.lblTotalCalcValue1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
+            this.lblTotalCalcValue1.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+            this.lblTotalCalcValue1.ForeColor = System.Drawing.Color.Black;
+            this.lblTotalCalcValue1.Location = new System.Drawing.Point(796, 28);
+            this.lblTotalCalcValue1.Name = "lblTotalCalcValue1";
+            this.lblTotalCalcValue1.Size = new System.Drawing.Size(140, 25);
+            this.lblTotalCalcValue1.TabIndex = 50;
+            this.lblTotalCalcValue1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+            // 
+            // lblTotalCalcValue2
+            // 
+            this.lblTotalCalcValue2.BackColor = System.Drawing.Color.White;
+            this.lblTotalCalcValue2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
+            this.lblTotalCalcValue2.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+            this.lblTotalCalcValue2.ForeColor = System.Drawing.Color.Black;
+            this.lblTotalCalcValue2.Location = new System.Drawing.Point(489, 53);
+            this.lblTotalCalcValue2.Name = "lblTotalCalcValue2";
+            this.lblTotalCalcValue2.Size = new System.Drawing.Size(140, 25);
+            this.lblTotalCalcValue2.TabIndex = 52;
+            this.lblTotalCalcValue2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+            // 
+            // label24
+            // 
+            this.label24.AutoSize = true;
+            this.label24.BackColor = System.Drawing.Color.PaleGoldenrod;
+            this.label24.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+            this.label24.ForeColor = System.Drawing.Color.Black;
+            this.label24.Location = new System.Drawing.Point(338, 34);
+            this.label24.Name = "label24";
+            this.label24.Size = new System.Drawing.Size(25, 16);
+            this.label24.TabIndex = 31;
+            this.label24.Text = "ï¼‹";
+            this.label24.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+            // 
+            // label25
+            // 
+            this.label25.AutoSize = true;
+            this.label25.BackColor = System.Drawing.Color.PaleGoldenrod;
+            this.label25.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+            this.label25.ForeColor = System.Drawing.Color.Black;
+            this.label25.Location = new System.Drawing.Point(338, 59);
+            this.label25.Name = "label25";
+            this.label25.Size = new System.Drawing.Size(25, 16);
+            this.label25.TabIndex = 47;
+            this.label25.Text = "ï¼‹";
+            this.label25.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+            // 
+            // lblCalcValue1
+            // 
+            this.lblCalcValue1.BackColor = System.Drawing.Color.White;
+            this.lblCalcValue1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
+            this.lblCalcValue1.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+            this.lblCalcValue1.ForeColor = System.Drawing.Color.Black;
+            this.lblCalcValue1.Location = new System.Drawing.Point(182, 3);
+            this.lblCalcValue1.Name = "lblCalcValue1";
+            this.lblCalcValue1.Size = new System.Drawing.Size(140, 25);
+            this.lblCalcValue1.TabIndex = 1;
+            this.lblCalcValue1.Text = "-999,999,999";
+            this.lblCalcValue1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+            // 
             // lblCalcValue2
             // 
             this.lblCalcValue2.BackColor = System.Drawing.Color.White;
@@ -719,32 +798,6 @@
             this.lblCalcValue2.TabIndex = 46;
             this.lblCalcValue2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
             // 
-            // label20
-            // 
-            this.label20.BackColor = System.Drawing.Color.LightGoldenrodYellow;
-            this.label20.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
-            this.label20.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
-            this.label20.ForeColor = System.Drawing.Color.Black;
-            this.label20.Location = new System.Drawing.Point(72, 28);
-            this.label20.Name = "label20";
-            this.label20.Size = new System.Drawing.Size(110, 25);
-            this.label20.TabIndex = 11;
-            this.label20.Text = "å‰¯æ‹…å½“å�Žç›Š";
-            this.label20.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
-            // 
-            // label13
-            // 
-            this.label13.AutoSize = true;
-            this.label13.BackColor = System.Drawing.Color.PaleGoldenrod;
-            this.label13.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
-            this.label13.ForeColor = System.Drawing.Color.Black;
-            this.label13.Location = new System.Drawing.Point(645, 7);
-            this.label13.Name = "label13";
-            this.label13.Size = new System.Drawing.Size(25, 16);
-            this.label13.TabIndex = 3;
-            this.label13.Text = "ï¼�";
-            this.label13.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
-            // 
             // lblCalcValue3
             // 
             this.lblCalcValue3.BackColor = System.Drawing.Color.White;
@@ -769,32 +822,18 @@
             this.lblTotalValue.TabIndex = 5;
             this.lblTotalValue.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
             // 
-            // label17
+            // lblTotalValue2
             // 
-            this.label17.BackColor = System.Drawing.Color.OldLace;
-            this.label17.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
-            this.label17.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
-            this.label17.ForeColor = System.Drawing.Color.Black;
-            this.label17.Location = new System.Drawing.Point(379, 28);
-            this.label17.Name = "label17";
-            this.label17.Size = new System.Drawing.Size(110, 25);
-            this.label17.TabIndex = 6;
-            this.label17.Text = "æŒ‡å°Žå“¡å�Žç›Š";
-            this.label17.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+            this.lblTotalValue2.BackColor = System.Drawing.Color.White;
+            this.lblTotalValue2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
+            this.lblTotalValue2.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+            this.lblTotalValue2.ForeColor = System.Drawing.Color.Black;
+            this.lblTotalValue2.Location = new System.Drawing.Point(489, 28);
+            this.lblTotalValue2.Name = "lblTotalValue2";
+            this.lblTotalValue2.Size = new System.Drawing.Size(140, 25);
+            this.lblTotalValue2.TabIndex = 33;
+            this.lblTotalValue2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
             // 
-            // label9
-            // 
-            this.label9.BackColor = System.Drawing.Color.Black;
-            this.label9.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
-            this.label9.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
-            this.label9.ForeColor = System.Drawing.Color.White;
-            this.label9.Location = new System.Drawing.Point(379, 3);
-            this.label9.Name = "label9";
-            this.label9.Size = new System.Drawing.Size(110, 25);
-            this.label9.TabIndex = 0;
-            this.label9.Text = "å½“æœŸäºˆæ¸¬çµ¦ä¸Ž";
-            this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
-            // 
             // lblPayroll
             // 
             this.lblPayroll.BackColor = System.Drawing.Color.White;
@@ -807,45 +846,6 @@
             this.lblPayroll.TabIndex = 0;
             this.lblPayroll.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
             // 
-            // label15
-            // 
-            this.label15.BackColor = System.Drawing.Color.DarkSeaGreen;
-            this.label15.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
-            this.label15.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
-            this.label15.ForeColor = System.Drawing.Color.DarkRed;
-            this.label15.Location = new System.Drawing.Point(686, 3);
-            this.label15.Name = "label15";
-            this.label15.Size = new System.Drawing.Size(110, 25);
-            this.label15.TabIndex = 4;
-            this.label15.Text = "çµŒé�Žçµ¦ä¸Žå·®é¡�";
-            this.label15.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
-            // 
-            // lblCalcValue1
-            // 
-            this.lblCalcValue1.BackColor = System.Drawing.Color.White;
-            this.lblCalcValue1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
-            this.lblCalcValue1.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
-            this.lblCalcValue1.ForeColor = System.Drawing.Color.Black;
-            this.lblCalcValue1.Location = new System.Drawing.Point(182, 3);
-            this.lblCalcValue1.Name = "lblCalcValue1";
-            this.lblCalcValue1.Size = new System.Drawing.Size(140, 25);
-            this.lblCalcValue1.TabIndex = 1;
-            this.lblCalcValue1.Text = "-999,999,999";
-            this.lblCalcValue1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
-            // 
-            // label10
-            // 
-            this.label10.BackColor = System.Drawing.Color.Blue;
-            this.label10.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
-            this.label10.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
-            this.label10.ForeColor = System.Drawing.Color.White;
-            this.label10.Location = new System.Drawing.Point(72, 3);
-            this.label10.Name = "label10";
-            this.label10.Size = new System.Drawing.Size(110, 25);
-            this.label10.TabIndex = 0;
-            this.label10.Text = "æŒ¯åˆ†æ¸ˆçµ¦ä¸Ž";
-            this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
-            // 
             // cmbDepartment
             // 
             this.cmbDepartment.BackColor = System.Drawing.Color.White;
@@ -1018,9 +1018,9 @@
         private System.Windows.Forms.Label label11;
         private System.Windows.Forms.Label lblTotalCalcValue1;
         private System.Windows.Forms.Label label19;
-        private System.Windows.Forms.Label lblPlusorMinus2;
+        private System.Windows.Forms.Label label25;
         private System.Windows.Forms.Label label16;
-        private System.Windows.Forms.Label lblPlusorMinus1;
+        private System.Windows.Forms.Label label24;
         private System.Windows.Forms.Label lblTotalCalcValue;
         private System.Windows.Forms.Label label12;
         private System.Windows.Forms.Label label22;
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedgerList/FrmConstructionLedgerListAuxiliary.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedgerList/FrmConstructionLedgerListAuxiliary.cs	(revision 343)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedgerList/FrmConstructionLedgerListAuxiliary.cs	(revision 344)
@@ -139,6 +139,28 @@
         }
         #endregion
 
+        #region ‰æ–ÊƒNƒŠƒA
+        /// <summary>
+        /// ‰æ–ÊƒNƒŠƒA
+        /// </summary>
+        private void ClearDisplay()
+        {
+            try
+            {
+                foreach (Control CurCtrl in pnlPayroll.Controls)
+                {
+                    if (CurCtrl.Name.IndexOf("lbl") < 0) continue;
+                    CurCtrl.Text = string.Empty;
+                }
+                dgvMaster.Rows.Clear();
+            }
+            catch (Exception ex)
+            {
+                logger.ErrorFormat("ƒVƒXƒeƒ€ƒGƒ‰�[�F{0}�F{1}", CommonMotions.GetMethodName(), ex.Message);
+            }
+        }
+        #endregion
+
         #region ŽŸƒvƒ�ƒZƒX‹N“®
         /// <summary>
         /// �HŽ–ˆê——‚æ‚è‹N“®‚·‚éƒvƒ�ƒZƒX‘I‘ð�ˆ—�
@@ -615,7 +637,7 @@
                 // �‡Œv‚ð�WŒv‚·‚é
                 foreach (object[] ObjRec in TargetList)
                 {
-                    int PersonCode = CommonMotions.cnvInt(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.PersonCode]);
+                    int PersonCode = CommonMotions.cnvInt(ObjRec[(int)CommonLedgerData.GetPersonTerm.PersonCode]);
                     // Œo”ïŽæ“¾
                     PersonExpensesCost[] GetCostList = ArraryCost.Where(x => x.PersonCode == PersonCode).ToArray();
                     foreach (PersonExpensesCost CurCostRec in GetCostList)
@@ -678,13 +700,10 @@
                 int DepartmentCode = GetDepartmentCode();
                 int PersonCode = CommonMotions.cnvInt(cmbConstructionPerson.SelectedValue);
 
+                int TargetYear = (int)numUDConstPro.Value;
                 int[] CostValue = new int[2];
-                // •\Ž¦ƒGƒŠƒAƒNƒŠƒA
-                Array.Clear(CostValue, 0, CostValue.Length);
+                CommonLedgerData.GetPersonAuxiliaryCostValue(TargetYear, DepartmentCode, PersonCode, ref CostValue);
 
-                // �U•ª‹àŠz‚ðŽæ“¾‚·‚é
-                GetPersonAuxiliaryCostValue(ref CostValue);
-
                 // ----- •â�•�U•ª‚Ì�WŒv
                 DataGridView dgv = dgvMaster;
                 int SumData = 0;
@@ -704,8 +723,8 @@
                 // ’S“–ŽÒ‚Ì�U•ª
                 int ConstrCost = 0;
                 int PayrollCost = CommonMotions.cnvInt(lblPayroll.Text);
-                // �U•ª‹‹—^‹àŠz�E�ƒ—˜‰v‹àŠz�E‘e—˜‰v‹àŠzŽæ“¾
-                CreateLedgerSQL.ProfitGeneral(LedgerDB, (int)numUDConstPro.Value, DepartmentCode, PersonCode, ref ConstrCost);
+                // �U•ª‹‹—^‹àŠzŽÀ�ÑŽæ“¾
+                CommonLedgerData.ProfitGeneral(LedgerDB, TargetYear, DepartmentCode, PersonCode, ref ConstrCost);
                 ConstrCost -= PayrollCost;
                 // �s�ì�¬
                 RowCnt = dgv.Rows.Add(1);
@@ -736,86 +755,6 @@
         }
         #endregion
 
-        #region ’S“–ŽÒ–ˆ‚Ì•â�•�U•ª‚ðŽæ“¾‚·‚é
-        /// <summary>
-        /// ’S“–ŽÒ–ˆ‚Ì•â�•�U•ª‚ðŽæ“¾‚·‚é
-        /// </summary>
-        /// <param name="PersonCDArray"></param>
-        /// <param name="CostValue"></param>
-        private void GetPersonAuxiliaryCostValue(ref int[] CostValue)
-        {
-            IOConstructionLedgerDetail DetailDB = new IOConstructionLedgerDetail();
-            try
-            {
-                int DepartmentCode = GetDepartmentCode();
-                int PersonCode = CommonMotions.cnvInt(cmbConstructionPerson.SelectedValue);
-                int NotOrder = CommonDefine.ProjectsStatus.First(x => x.Value.Equals("”ñ Žó ’�")).Key;
-
-                // �HŽ–�Ú�×‘ä’ ƒf�[ƒ^‚æ‚è•â�•�U•ª‚ðŽæ“¾‚·‚é
-                StringBuilder strSQL = new StringBuilder();
-                strSQL.Append("SELECT A.CONSTRUCTIONPERIOD, P.GROUPCOUNT, SUM(B.PAYMENTAMOUNT)");
-                strSQL.Append(" FROM CONSTRUCTIONLEDGERDETAIL P LEFT JOIN CONSTRUCTIONLEDGEREXCUTE B");
-                strSQL.Append(" ON B.CONSTRUCTIONCODE = P.CONSTRUCTIONCODE AND B.GROUPCOUNT = P.GROUPCOUNT AND B.LINECOUNT = P.LINECOUNT");
-                strSQL.Append(", CONSTRUCTIONBASEINFO A");
-                strSQL.AppendFormat(" WHERE P.GROUPCOUNT IN ({0}, {1})"
-                                    , (int)FrmConstructionLedger.DataGroup.Instructor
-                                    , (int)FrmConstructionLedger.DataGroup.Assistant);
-
-                strSQL.Append(" AND P.COMPANYCODE IN (SELECT A1.PERSONCODE FROM PERSONINCHARGEMASTER A1");
-                strSQL.Append(" WHERE (A1.DELETEFLG = 0 OR A1.DELETEFLG = 1)");
-
-                if (CommonMotions.LoginUserData.PersonCode != CommonDefine.AdminCode)
-                {
-                    strSQL.Append(" AND A1.DEPARTMENTCODE IN (select PDep.DepartmentCode from PersonDepartmentMaster AS PDep");
-                    strSQL.AppendFormat(" WHERE PDep.PersonCode = {0})", CommonMotions.LoginUserData.PersonCode);
-                }
-
-                //if (DepartmentCode != 0) strSQL.AppendFormat(" AND A1.DEPARTMENTCODE = {0}", DepartmentCode);
-                //if (PersonCode != 0) strSQL.AppendFormat(" AND A1.PERSONCODE = {0}", PersonCode);
-                if (DepartmentCode != 0)
-                {
-                    strSQL.AppendFormat(" AND (A.ConstrSubDepCode = {0}", DepartmentCode);
-                    strSQL.AppendFormat(" Or A.ConstrInstrDepCode = {0})", DepartmentCode);
-                }
-                if (PersonCode != 0)
-                {
-                    strSQL.AppendFormat(" AND (A.ConstrSubPersonCode = {0}", PersonCode);
-                    strSQL.AppendFormat(" Or  A.ConstructionInstructor = {0})", PersonCode);
-                }
-
-                strSQL.Append(" )");
-                strSQL.Append(" AND P.CONSTRUCTIONCODE = A.CONSTRUCTIONCODE");
-                strSQL.AppendFormat(" AND A.CONSTRUCTIONSTATUSFLG <> {0}", NotOrder);
-                strSQL.AppendFormat(" AND A.CONSTRUCTIONPERIOD = {0}", numUDConstPro.Value);
-                strSQL.Append(" GROUP BY A.CONSTRUCTIONPERIOD, P.GROUPCOUNT");
-
-                ArrayList arList = new ArrayList();
-                if (!DetailDB.ExecuteReader(strSQL.ToString(), ref arList)) return;
-
-                // Žæ“¾Œ‹‰Ê‚ð�U‚è•ª‚¯‚é
-                foreach (object[] wrkobj in arList)
-                {
-                    if (CommonMotions.cnvInt(wrkobj[1]) == (int)FrmConstructionLedger.DataGroup.Assistant)
-                    {
-                        CostValue[0] = CommonMotions.cnvInt(wrkobj[2]);
-                    }
-                    else
-                    {
-                        CostValue[1] = CommonMotions.cnvInt(wrkobj[2]);
-                    }
-                }
-            }
-            catch (Exception ex)
-            {
-                logger.ErrorFormat("ƒVƒXƒeƒ€ƒGƒ‰�[�F{0}�F{1}", CommonMotions.GetMethodName(), ex.Message);
-            }
-            finally
-            {
-                DetailDB.close(); DetailDB = null;
-            }
-        }
-        #endregion
-
         #region ƒvƒ�ƒOƒŒƒXƒo�[•\Ž¦�§Œä
         /// <summary>
         /// ƒvƒ�ƒOƒŒƒXƒo�[•\Ž¦�§Œä
@@ -998,7 +937,7 @@
 
                 // ----- ’S“–ŽÒ–ˆ‚ÌŽw’èŠú‚ÌŠJŽn�E�I—¹”NŒŽ“ú‚ðŽæ“¾‚·‚é
                 ArrayList TargetList = new ArrayList();
-                CreateLedgerSQL.GetPersonInDepartment((int)numUDConstPro.Value,
+                CommonLedgerData.GetPersonInDepartment((int)numUDConstPro.Value,
                                                     GetDepartmentCode(),
                                                     CommonMotions.cnvInt(cmbConstructionPerson.SelectedValue),
                                                     ref TargetList);
@@ -1009,13 +948,11 @@
 
                 // ‘Î�Û‚ÌŒo‰ß‹‹—^‚ðŽæ“¾‚·‚é
                 List<SalaryClass> ArrarySalary = new List<SalaryClass>();
-                //CreateLedgerSQL.GetElapsedSalary(SalaryDB, (int)numUDConstPro.Value, TargetList, ref ArrarySalary);
-                CreateLedgerSQL.GetElapsedSalaryAll(SalaryDB, (int)numUDConstPro.Value, ref TargetList, ref ArrarySalary);
+                CommonLedgerData.GetElapsedSalaryAll(SalaryDB, (int)numUDConstPro.Value, ref TargetList, ref ArrarySalary);
 
                 // ‘Î�Û‚ÌŒo”ï‚ðŽæ“¾‚·‚é
                 List<PersonExpensesCost> ArraryCost = new List<PersonExpensesCost>();
-                //CreateLedgerSQL.GetPersonExpensesCostValue(CostDB, (int)numUDConstPro.Value, ArrarySalary, ref ArraryCost);
-                CreateLedgerSQL.GetPersonExpensesCostValueAll(CostDB, (int)numUDConstPro.Value, ArrarySalary, ref ArraryCost);
+                CommonLedgerData.GetPersonExpensesCostValueAll(CostDB, (int)numUDConstPro.Value, ArrarySalary, ref ArraryCost);
 
                 // ProgressBar‚Ì’l‚ð•Ï�X‚·‚é
                 prgber.Value++;
@@ -1035,7 +972,7 @@
                 prgber.Value++;
                 prgber.Update();
 
-                // ------ �U•ª‹‹—^‚ð•\Ž¦‚·‚é
+                // ------ •â�•�U•ª‹‹—^‚ð•\Ž¦‚·‚é
                 int Auxiliary = 0;
                 Auxiliary = SetAuxiliaryCost(LedgerDB);
 
@@ -1051,11 +988,7 @@
                 
                 // �ƒ—˜‰v
                 TotalArea[(int)DispColumn.NetProfit] -= Expenses;                   // �ƒ—˜‰v-Œo”ï
-                
-                //if (Auxiliary < 0)
-                    TotalArea[(int)DispColumn.NetProfit] += Auxiliary;              // �ƒ—˜‰v+•â�•�lŒ�”ï
-                //else
-                //    TotalArea[(int)DispColumn.NetProfit] -= Auxiliary;              // �ƒ—˜‰v-•â�•�lŒ�”ï(�lŒ�”ï‚ª�{‚É‚È‚Á‚½�ê�‡‚Í‚»‚ê‚ðˆø‚­)
+                TotalArea[(int)DispColumn.NetProfit] += Auxiliary;                  // �ƒ—˜‰v+•â�•�lŒ�”ï
 
                 // ----- ‘��‡Œv�s•\Ž¦
                 dgv.Rows.Add();       // ‹ó�s
@@ -1072,7 +1005,6 @@
                     dgv.Rows[AllTotalRow].Cells[i].Value = TotalArea[i].ToString("#,0");
                 }
 
-
                 // ProgressBar‚Ì’l‚ð•Ï�X‚·‚é
                 prgber.Value = prgber.Maximum;
                 prgber.Update();
@@ -1354,7 +1286,6 @@
                 int TotalSalary = 0;        // ‹‹—^—Ý�ÏŽæ“¾
                 int OnSalary = 0;           // �U•ª‹‹—^‹àŠzŽæ“¾
 
-                int PersonCode = 0;
                 DateTime stDate = DateTime.Today;
                 DateTime edDate = DateTime.Today;
                 DateTime DspSTDate = DateTime.MaxValue;
@@ -1364,18 +1295,18 @@
                 foreach (object[] ObjRec in TargetList)
                 {
                     // ŠJŽn�E�I—¹“ú‚ª–³‚¢�ê�‡‚ÍƒfƒtƒHƒ‹ƒg‚ÌŠúŽñ�EŠú––‚ðŽg—p‚·‚é
-                    stDate = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.StartDate]);
-                    edDate = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.CompDate]);
+                    stDate = CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.StartDate]);
+                    edDate = CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.CompDate]);
 
                     // ’S“–ŽÒŽæ“¾
-                    PersonCode = CommonMotions.cnvInt(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.PersonCode]);
+                    int nPersonCode = CommonMotions.cnvInt(ObjRec[(int)CommonLedgerData.GetPersonTerm.PersonCode]);
 
                     // ‹‹—^—Ý�ÏŽæ“¾
-                    TotalSalary += ArrarySalary.Where(x => x.PersonCode == PersonCode).Sum(y => y.SalaryValue);
+                    TotalSalary += ArrarySalary.Where(x => x.PersonCode == nPersonCode).Sum(y => y.SalaryValue);
 
                     // ’S“–ŽÒ‘I‘ðŽž�F�U•ª‹‹—^‹àŠz�E�ƒ—˜‰v‹àŠz�E‘e—˜‰v‹àŠzŽæ“¾
                     int wrkSalary = 0;
-                    CreateLedgerSQL.ProfitGeneral(LedgerDB, (int)numUDConstPro.Value, DepartmentCode, PersonCode, ref wrkSalary, false);
+                    CommonLedgerData.ProfitGeneral(LedgerDB, (int)numUDConstPro.Value, DepartmentCode, nPersonCode, ref wrkSalary, false);
                     OnSalary += wrkSalary;
 
                     // •\Ž¦“ú•tŽæ“¾
@@ -1396,8 +1327,10 @@
                 lblCalcValue3.Text = TotalValue.ToString("#,0");
 
                 // �U•ª‹àŠz‚ðŽæ“¾‚·‚é
+                int TargetYear = (int)numUDConstPro.Value;
+                int PersonCode = CommonMotions.cnvInt(cmbConstructionPerson.SelectedValue);
                 int[] CostValue = new int[2];
-                GetPersonAuxiliaryCostValue(ref CostValue);
+                CommonLedgerData.GetPersonAuxiliaryCostValue(TargetYear, DepartmentCode, PersonCode, ref CostValue);
 
                 // •›’S“–ŽÒŽû‰v‹àŠz•\Ž¦
                 lblCalcValue2.Text = CostValue[0].ToString("#,0");
@@ -1591,6 +1524,7 @@
             {
                 cmbConstructionPerson.SelectedIndexChanged -= new EventHandler(cmbConstructionPerson_SelectedIndexChanged);
                 int nBeforeCode = CommonMotions.cnvInt(cmbConstructionPerson.SelectedValue);
+                if (CommonMotions.cnvInt(cmbDepartment.SelectedValue) < 1) nBeforeCode = 0;
 
                 cmbConstructionPerson.DataSource = null;
                 cmbConstructionPerson.Items.Clear();
@@ -1669,9 +1603,10 @@
                 PersonRec.DepartmentCode = CommonMotions.cnvInt(objRec[2]);     // •”��ƒR�[ƒh
 
                 // “¯‚¶•”��‚Ì�ê�‡‚Í�ˆ—�‚µ‚È‚¢
-                if (DepartmentCode == PersonRec.DepartmentCode) return true;
+                //if (DepartmentCode == PersonRec.DepartmentCode) return true;
 
                 // •”��ƒRƒ“ƒ{ƒ{ƒbƒNƒX‚Ö•”��ƒR�[ƒhƒZƒbƒg
+                SetcmbDepartment();
                 cmbDepartment.SelectedValue = PersonRec.DepartmentCode;
                 SetcmbPersons();    // ’S“–ŽÒƒRƒ“ƒ{ƒ{ƒbƒNƒX•Ï�X
                 cmbConstructionPerson.SelectedValue = PersonCode;
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionSplit/FrmConstructionSplitAuxiliary.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionSplit/FrmConstructionSplitAuxiliary.cs	(revision 343)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionSplit/FrmConstructionSplitAuxiliary.cs	(revision 344)
@@ -247,6 +247,7 @@
             {
                 cmbConstructionPerson.SelectedIndexChanged -= new EventHandler(cmbConstructionPerson_SelectedIndexChanged);
                 int nBeforeCode = CommonMotions.cnvInt(cmbConstructionPerson.SelectedValue);
+                if (CommonMotions.cnvInt(cmbDepartment.SelectedValue) < 1) nBeforeCode = 0;
 
                 cmbConstructionPerson.DataSource = null;
                 cmbConstructionPerson.Items.Clear();
@@ -325,9 +326,10 @@
                 PersonRec.DepartmentCode = CommonMotions.cnvInt(objRec[2]);     // éƒ¨ç½²ã‚³ãƒ¼ãƒ‰
 
                 // å�Œã�˜éƒ¨ç½²ã�®å ´å�ˆã�¯å‡¦ç�†ã�—ã�ªã�„
-                if (DepartmentCode == PersonRec.DepartmentCode) return true;
+                //if (DepartmentCode == PersonRec.DepartmentCode) return true;
 
                 // éƒ¨ç½²ã‚³ãƒ³ãƒœãƒœãƒƒã‚¯ã‚¹ã�¸éƒ¨ç½²ã‚³ãƒ¼ãƒ‰ã‚»ãƒƒãƒˆ
+                SetcmbDepartment();
                 cmbDepartment.SelectedValue = PersonRec.DepartmentCode;
                 SetcmbPersons();    // æ‹…å½“è€…ã‚³ãƒ³ãƒœãƒœãƒƒã‚¯ã‚¹å¤‰æ›´
                 cmbConstructionPerson.SelectedValue = PersonCode;
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/CopyTargetList/FrmCopyTargetListAuxiliary.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/CopyTargetList/FrmCopyTargetListAuxiliary.cs	(revision 343)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/CopyTargetList/FrmCopyTargetListAuxiliary.cs	(revision 344)
@@ -713,6 +713,7 @@
             {
                 cmbConstructionPerson.SelectedIndexChanged -= new EventHandler(cmbConstructionPerson_SelectedIndexChanged);
                 int nBeforeCode = CommonMotions.cnvInt(cmbConstructionPerson.SelectedValue);
+                if (CommonMotions.cnvInt(cmbDepartment.SelectedValue) < 1) nBeforeCode = 0;
 
                 cmbConstructionPerson.DataSource = null;
                 cmbConstructionPerson.Items.Clear();
@@ -791,9 +792,10 @@
                 PersonRec.DepartmentCode = CommonMotions.cnvInt(objRec[2]);     // •”��ƒR�[ƒh
 
                 // “¯‚¶•”��‚Ì�ê�‡‚Í�ˆ—�‚µ‚È‚¢
-                if (DepartmentCode == PersonRec.DepartmentCode) return true;
+                //if (DepartmentCode == PersonRec.DepartmentCode) return true;
 
                 // •”��ƒRƒ“ƒ{ƒ{ƒbƒNƒX‚Ö•”��ƒR�[ƒhƒZƒbƒg
+                SetcmbDepartment();
                 cmbDepartment.SelectedValue = PersonRec.DepartmentCode;
                 SetcmbPersons();    // ’S“–ŽÒƒRƒ“ƒ{ƒ{ƒbƒNƒX•Ï�X
                 cmbConstructionPerson.SelectedValue = PersonCode;
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/CostomerRegist/FrmCostomerRegistListAuxiliary.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/CostomerRegist/FrmCostomerRegistListAuxiliary.cs	(revision 343)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/CostomerRegist/FrmCostomerRegistListAuxiliary.cs	(revision 344)
@@ -676,6 +676,7 @@
             {
                 cmbConstructionPerson.SelectedIndexChanged -= new EventHandler(cmbConstructionPerson_SelectedIndexChanged);
                 int nBeforeCode = CommonMotions.cnvInt(cmbConstructionPerson.SelectedValue);
+                if (CommonMotions.cnvInt(cmbDepartment.SelectedValue) < 1) nBeforeCode = 0;
 
                 cmbConstructionPerson.DataSource = null;
                 cmbConstructionPerson.Items.Clear();
@@ -754,9 +755,10 @@
                 PersonRec.DepartmentCode = CommonMotions.cnvInt(objRec[2]);     // •”��ƒR�[ƒh
 
                 // “¯‚¶•”��‚Ì�ê�‡‚Í�ˆ—�‚µ‚È‚¢
-                if (DepartmentCode == PersonRec.DepartmentCode) return true;
+                //if (DepartmentCode == PersonRec.DepartmentCode) return true;
 
                 // •”��ƒRƒ“ƒ{ƒ{ƒbƒNƒX‚Ö•”��ƒR�[ƒhƒZƒbƒg
+                SetcmbDepartment();
                 cmbDepartment.SelectedValue = PersonRec.DepartmentCode;
                 SetcmbPersons();    // ’S“–ŽÒƒRƒ“ƒ{ƒ{ƒbƒNƒX•Ï�X
                 cmbConstructionPerson.SelectedValue = PersonCode;
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/DRList/FrmDRListAuxiliary.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/DRList/FrmDRListAuxiliary.cs	(revision 343)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/DRList/FrmDRListAuxiliary.cs	(revision 344)
@@ -916,6 +916,7 @@
             {
                 cmbConstructionPerson.SelectedIndexChanged -= new EventHandler(cmbPerson_SelectedIndexChanged);
                 int nBeforeCode = CommonMotions.cnvInt(cmbConstructionPerson.SelectedValue);
+                if (CommonMotions.cnvInt(cmbDepartment.SelectedValue) < 1) nBeforeCode = 0;
 
                 cmbConstructionPerson.DataSource = null;
                 cmbConstructionPerson.Items.Clear();
@@ -995,9 +996,10 @@
                 PersonRec.DepartmentCode = CommonMotions.cnvInt(objRec[2]);     // •”��ƒR�[ƒh
 
                 // “¯‚¶•”��‚Ì�ê�‡‚Í�ˆ—�‚µ‚È‚¢
-                if (DepartmentCode == PersonRec.DepartmentCode) return true;
+                //if (DepartmentCode == PersonRec.DepartmentCode) return true;
 
                 // •”��ƒRƒ“ƒ{ƒ{ƒbƒNƒX‚Ö•”��ƒR�[ƒhƒZƒbƒg
+                SetcmbDepartment();
                 cmbDepartment.SelectedValue = PersonRec.DepartmentCode;
                 SetcmbPersons();    // ’S“–ŽÒƒRƒ“ƒ{ƒ{ƒbƒNƒX•Ï�X
                 cmbConstructionPerson.SelectedValue = PersonCode;
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/DRWork/FrmDRWorkAuxiliary.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/DRWork/FrmDRWorkAuxiliary.cs	(revision 343)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/DRWork/FrmDRWorkAuxiliary.cs	(revision 344)
@@ -1057,6 +1057,7 @@
             {
                 cmbConstructionPerson.SelectedIndexChanged -= new EventHandler(cmbConstructionPerson_SelectedIndexChanged);
                 int nBeforeCode = CommonMotions.cnvInt(cmbConstructionPerson.SelectedValue);
+                if (CommonMotions.cnvInt(cmbDepartment.SelectedValue) < 1) nBeforeCode = 0;
 
                 cmbConstructionPerson.DataSource = null;
                 cmbConstructionPerson.Items.Clear();
@@ -1113,6 +1114,9 @@
             IOMPersonInCharge PersonDB = new IOMPersonInCharge();
             try
             {
+                cmbDepartment.SelectedIndexChanged -= new EventHandler(cmbDepartment_SelectedIndexChanged);
+                cmbConstructionPerson.SelectedIndexChanged -= new EventHandler(cmbConstructionPerson_SelectedIndexChanged);
+
                 // ã‚³ãƒ³ãƒœãƒœãƒƒã‚¯ã‚¹ã‚ˆã‚Šé�¸æŠžæ‹…å½“è€…ã‚’å�–å¾—ã�™ã‚‹
                 int PersonCode = GetConstructionPersonCode();
                 if (PersonCode < 1) return false;
@@ -1126,15 +1130,16 @@
                 SetPersonalCosts(PersonRec);
 
                 // éƒ¨ç½²ã‚³ãƒ³ãƒœãƒœãƒƒã‚¯ã‚¹ã�¸éƒ¨ç½²ã‚³ãƒ¼ãƒ‰ã‚»ãƒƒãƒˆ
-                if (PersonRec.DepartmentCode > 0 && DepartmentCode != PersonRec.DepartmentCode)
-                {
-                    bool bSave = m_bInitFlg;
-                    m_bInitFlg = true;
-                    cmbDepartment.SelectedValue = PersonRec.DepartmentCode;
-                    SetcmbPersons();    // æ‹…å½“è€…ã‚³ãƒ³ãƒœãƒœãƒƒã‚¯ã‚¹å¤‰æ›´
-                    cmbConstructionPerson.SelectedValue = PersonCode;
-                    m_bInitFlg = bSave;
-                }
+                //if (PersonRec.DepartmentCode > 0 && DepartmentCode != PersonRec.DepartmentCode)
+                //{
+                bool bSave = m_bInitFlg;
+                m_bInitFlg = true;
+                SetcmbDepartment();
+                cmbDepartment.SelectedValue = PersonRec.DepartmentCode;
+                SetcmbPersons();    // æ‹…å½“è€…ã‚³ãƒ³ãƒœãƒœãƒƒã‚¯ã‚¹å¤‰æ›´
+                cmbConstructionPerson.SelectedValue = PersonCode;
+                m_bInitFlg = bSave;
+                //}
 
                 return true;
             }
@@ -1146,6 +1151,8 @@
             finally
             {
                 PersonDB.close(); PersonDB = null;
+                cmbDepartment.SelectedIndexChanged += new EventHandler(cmbDepartment_SelectedIndexChanged);
+                cmbConstructionPerson.SelectedIndexChanged += new EventHandler(cmbConstructionPerson_SelectedIndexChanged);
             }
         }
         #endregion
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/DepExpenssList/FrmDepExpenssList.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/DepExpenssList/FrmDepExpenssList.cs	(revision 343)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/DepExpenssList/FrmDepExpenssList.cs	(revision 344)
@@ -494,6 +494,9 @@
         {
             if (m_initDataLoad) return;
 
+            // ‰æ–ÊƒNƒŠƒA
+            ClearDisplay();
+
             // •”��ƒRƒ“ƒ{ƒ{ƒbƒNƒX•Ï�X
             SetcmbDepartment();
 
@@ -512,6 +515,9 @@
         {
             if (m_initDataLoad) return;
 
+            // ‰æ–ÊƒNƒŠƒA
+            ClearDisplay();
+
             // ƒf�[ƒ^•\Ž¦
             DataDisplay();
         }
@@ -529,5 +535,10 @@
             DispPriceOfBudget();
         }
         #endregion
+
+        private void button1_Click(object sender, EventArgs e)
+        {
+            SetDepartmentCode();
+        }
     }
 }
\ No newline at end of file
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/DepExpenssList/FrmDepExpenssList.designer.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/DepExpenssList/FrmDepExpenssList.designer.cs	(revision 343)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/DepExpenssList/FrmDepExpenssList.designer.cs	(revision 344)
@@ -46,6 +46,7 @@
             this.lblCellTotal = new System.Windows.Forms.Label();
             this.ProgressBar = new System.Windows.Forms.ProgressBar();
             this.btnLedgerStatus = new System.Windows.Forms.Button();
+            this.button1 = new System.Windows.Forms.Button();
             this.dgvMaster = new ProcessManagement.Forms.CustomControls.DataGridViewEX();
             this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -69,9 +70,9 @@
             this.label11 = new System.Windows.Forms.Label();
             this.lblTotalCalcValue1 = new System.Windows.Forms.Label();
             this.label19 = new System.Windows.Forms.Label();
-            this.lblPlusorMinus2 = new System.Windows.Forms.Label();
+            this.label25 = new System.Windows.Forms.Label();
             this.label16 = new System.Windows.Forms.Label();
-            this.lblPlusorMinus1 = new System.Windows.Forms.Label();
+            this.label24 = new System.Windows.Forms.Label();
             this.lblTotalCalcValue = new System.Windows.Forms.Label();
             this.label12 = new System.Windows.Forms.Label();
             this.label22 = new System.Windows.Forms.Label();
@@ -162,6 +163,17 @@
             this.btnLedgerStatus.UseVisualStyleBackColor = false;
             this.btnLedgerStatus.Click += new System.EventHandler(this.btnLedgerStatus_Click);
             // 
+            // button1
+            // 
+            this.button1.Location = new System.Drawing.Point(881, 619);
+            this.button1.Name = "button1";
+            this.button1.Size = new System.Drawing.Size(120, 30);
+            this.button1.TabIndex = 49;
+            this.button1.Text = "ãƒ‡ãƒ�ãƒƒã‚°";
+            this.button1.UseVisualStyleBackColor = true;
+            this.button1.Visible = false;
+            this.button1.Click += new System.EventHandler(this.button1_Click);
+            // 
             // dgvMaster
             // 
             this.dgvMaster.AllowUserToAddRows = false;
@@ -380,9 +392,9 @@
             this.pnlPayroll.Controls.Add(this.label11);
             this.pnlPayroll.Controls.Add(this.lblTotalCalcValue1);
             this.pnlPayroll.Controls.Add(this.label19);
-            this.pnlPayroll.Controls.Add(this.lblPlusorMinus2);
+            this.pnlPayroll.Controls.Add(this.label25);
             this.pnlPayroll.Controls.Add(this.label16);
-            this.pnlPayroll.Controls.Add(this.lblPlusorMinus1);
+            this.pnlPayroll.Controls.Add(this.label24);
             this.pnlPayroll.Controls.Add(this.lblTotalCalcValue);
             this.pnlPayroll.Controls.Add(this.label12);
             this.pnlPayroll.Controls.Add(this.label22);
@@ -529,18 +541,18 @@
             this.label19.Text = "æ‹…å½“å¤–å�Žç›Š";
             this.label19.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
             // 
-            // lblPlusorMinus2
+            // label25
             // 
-            this.lblPlusorMinus2.AutoSize = true;
-            this.lblPlusorMinus2.BackColor = System.Drawing.Color.LightSteelBlue;
-            this.lblPlusorMinus2.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
-            this.lblPlusorMinus2.ForeColor = System.Drawing.Color.Black;
-            this.lblPlusorMinus2.Location = new System.Drawing.Point(338, 59);
-            this.lblPlusorMinus2.Name = "lblPlusorMinus2";
-            this.lblPlusorMinus2.Size = new System.Drawing.Size(25, 16);
-            this.lblPlusorMinus2.TabIndex = 47;
-            this.lblPlusorMinus2.Text = "ï¼‹";
-            this.lblPlusorMinus2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+            this.label25.AutoSize = true;
+            this.label25.BackColor = System.Drawing.Color.LightSteelBlue;
+            this.label25.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+            this.label25.ForeColor = System.Drawing.Color.Black;
+            this.label25.Location = new System.Drawing.Point(338, 59);
+            this.label25.Name = "label25";
+            this.label25.Size = new System.Drawing.Size(25, 16);
+            this.label25.TabIndex = 47;
+            this.label25.Text = "ï¼‹";
+            this.label25.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
             // 
             // label16
             // 
@@ -555,18 +567,18 @@
             this.label16.Text = "ï¼�";
             this.label16.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
             // 
-            // lblPlusorMinus1
+            // label24
             // 
-            this.lblPlusorMinus1.AutoSize = true;
-            this.lblPlusorMinus1.BackColor = System.Drawing.Color.LightSteelBlue;
-            this.lblPlusorMinus1.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
-            this.lblPlusorMinus1.ForeColor = System.Drawing.Color.Black;
-            this.lblPlusorMinus1.Location = new System.Drawing.Point(338, 34);
-            this.lblPlusorMinus1.Name = "lblPlusorMinus1";
-            this.lblPlusorMinus1.Size = new System.Drawing.Size(25, 16);
-            this.lblPlusorMinus1.TabIndex = 31;
-            this.lblPlusorMinus1.Text = "ï¼‹";
-            this.lblPlusorMinus1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+            this.label24.AutoSize = true;
+            this.label24.BackColor = System.Drawing.Color.LightSteelBlue;
+            this.label24.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+            this.label24.ForeColor = System.Drawing.Color.Black;
+            this.label24.Location = new System.Drawing.Point(338, 34);
+            this.label24.Name = "label24";
+            this.label24.Size = new System.Drawing.Size(25, 16);
+            this.label24.TabIndex = 31;
+            this.label24.Text = "ï¼‹";
+            this.label24.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
             // 
             // lblTotalCalcValue
             // 
@@ -850,6 +862,7 @@
             this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
             this.BackColor = System.Drawing.Color.Black;
             this.ClientSize = new System.Drawing.Size(1340, 657);
+            this.Controls.Add(this.button1);
             this.Controls.Add(this.btnLedgerStatus);
             this.Controls.Add(this.ProgressBar);
             this.Controls.Add(this.lblCellTotal);
@@ -908,9 +921,9 @@
         private System.Windows.Forms.Label label11;
         private System.Windows.Forms.Label lblTotalCalcValue1;
         private System.Windows.Forms.Label label19;
-        private System.Windows.Forms.Label lblPlusorMinus2;
+        private System.Windows.Forms.Label label25;
         private System.Windows.Forms.Label label16;
-        private System.Windows.Forms.Label lblPlusorMinus1;
+        private System.Windows.Forms.Label label24;
         private System.Windows.Forms.Label lblTotalCalcValue;
         private System.Windows.Forms.Label label12;
         private System.Windows.Forms.Label label22;
@@ -933,5 +946,6 @@
         private System.Windows.Forms.Label label3;
         private System.Windows.Forms.Button btnLedgerStatus;
         private System.Windows.Forms.Label label18;
+        private System.Windows.Forms.Button button1;
     }
 }
\ No newline at end of file
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/DepExpenssList/FrmDepExpenssListAuxiliary.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/DepExpenssList/FrmDepExpenssListAuxiliary.cs	(revision 343)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/DepExpenssList/FrmDepExpenssListAuxiliary.cs	(revision 344)
@@ -263,8 +263,8 @@
 
 
                 // ------ Œo”ï�E�U•ª�lŒ�”ïŽæ“¾
-                int ArrayCount = CostDataOfPerson.DataNoStrArrary.Length;
-                int[] CostValue2 = new int[ArrayCount];
+                int TargetYear = (int)numUDConstPro.Value;
+                int CostValue = 0;
                 int TotalSalary = 0;
                 int OnSalary = 0;
                 DateTime stDate = DateTime.MaxValue;
@@ -272,30 +272,25 @@
 
                 if (PersonCode == 0)
                 {
-                    //int[] CostValue2Dep = new int[ArrayCount];
                     int CurPersonCode = 0;
                     foreach (object[] ObjRec in TargetList)
                     {
-                        int nDepCode = CommonMotions.cnvInt(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.DepartmentCode]);
+                        int nDepCode = CommonMotions.cnvInt(ObjRec[(int)CommonLedgerData.GetPersonTerm.DepartmentCode]);
                         if (nDepCode != DepartmentCode) continue;
 
-                        CurPersonCode = CommonMotions.cnvInt(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.PersonCode]);
+                        CurPersonCode = CommonMotions.cnvInt(ObjRec[(int)CommonLedgerData.GetPersonTerm.PersonCode]);
                         // Œo”ïŽæ“¾
                         PersonExpensesCost[] GetCostList = ArraryCost.Where(x => x.PersonCode == CurPersonCode).ToArray();
-                        foreach(PersonExpensesCost CurCostRec in GetCostList)
+                        foreach (PersonExpensesCost CurCostRec in GetCostList)
                         {
-                            for (int i = 0; i < CostValue2.Length; i++)
-                            {
-                                CostValue2[i] += CurCostRec.CostValue[i];
-                            }
+                            CostValue += CurCostRec.CostValue.Sum();
                         }
-
-                        // ‹‹—^—Ý�ÏŽæ“¾
-                        TotalSalary += ArrarySalary.Where(x => x.DepartmentCode == DepartmentCode && x.PersonCode == CurPersonCode).Sum(y => y.SalaryValue);
                     }
+                    // ‹‹—^—Ý�ÏŽæ“¾
+                    TotalSalary += ArrarySalary.Where(x => x.DepartmentCode == DepartmentCode).Sum(y => y.SalaryValue);
 
-                    // �U•ª‹‹—^‹àŠz�E�ƒ—˜‰v‹àŠz�E‘e—˜‰v‹àŠzŽæ“¾
-                    CreateLedgerSQL.ProfitGeneral(LedgerDB, (int)numUDConstPro.Value, DepartmentCode, 0, ref OnSalary);
+                    // �U•ª‹‹—^‹àŠz
+                    CommonLedgerData.ProfitGeneral(LedgerDB, TargetYear, DepartmentCode, 0, ref OnSalary);
                 }
                 else
                 {
@@ -303,7 +298,7 @@
                     foreach (object[] ObjRec in TargetList)
                     {
                         // “¯‚¶’S“–ŽÒƒR�[ƒh‚ð’T‚·
-                        if (PersonCode == CommonMotions.cnvInt(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.PersonCode]))
+                        if (PersonCode == CommonMotions.cnvInt(ObjRec[(int)CommonLedgerData.GetPersonTerm.PersonCode]))
                         {
                             ObjCur = ObjRec;
                             break;
@@ -315,38 +310,33 @@
                     PersonExpensesCost[] GetCostList = ArraryCost.Where(x => x.PersonCode == PersonCode).ToArray();
                     foreach (PersonExpensesCost CurCostRec in GetCostList)
                     {
-                        for (int i = 0; i < CostValue2.Length; i++)
-                        {
-                            CostValue2[i] += CurCostRec.CostValue[i];
-                        }
+                        CostValue += CurCostRec.CostValue.Sum();
                     }
-                    //CreateLedgerSQL.GetPersonExpensesCostValue(CostDB, 0, PersonCode, dtDefaultStart, dtDefaultEnd, ref CostValue2);
-
-                    // �U•ª‹‹—^‹àŠz�E�ƒ—˜‰v‹àŠz�E‘e—˜‰v‹àŠzŽæ“¾
-                    CreateLedgerSQL.ProfitGeneral(LedgerDB, (int)numUDConstPro.Value, DepartmentCode, PersonCode, ref OnSalary);
-
                     // ‹‹—^—Ý�ÏŽæ“¾
                     TotalSalary = ArrarySalary.Where(x => x.PersonCode == PersonCode).Sum(y => y.SalaryValue);
+
+                    // �U•ª‹‹—^‹àŠz
+                    CommonLedgerData.ProfitGeneral(LedgerDB, TargetYear, DepartmentCode, PersonCode, ref OnSalary);
                 }
                 // ----- Œo”ï“™‰ÁŽZ
-                // ‘�Žx•¥Šz+=�w“ü•i
-                wrkArray[(int)DBGetData.TotalPayment] += CostValue2.Sum();
-                // ‘e—˜‰v-=�w“ü•i
-                wrkArray[(int)DBGetData.GrossProfit] -= CostValue2.Sum();
-                // �ƒ—˜‰v-=�w“ü•i
-                wrkArray[(int)DBGetData.NetProfit] -= CostValue2.Sum();
+                // ‘�Žx•¥Šz+=�HŽ–ŠO�w“ü•i
+                wrkArray[(int)DBGetData.TotalPayment] += CostValue;
+                // ‘e—˜‰v-=�HŽ–ŠO�w“ü•i
+                wrkArray[(int)DBGetData.GrossProfit] -= CostValue;
+                // �ƒ—˜‰v-=�HŽ–ŠO�w“ü•i
+                wrkArray[(int)DBGetData.NetProfit] -= CostValue;
 
-                int TotalValue = OnSalary - TotalSalary;
-                wrkArray[(int)DBGetData.NetProfit] += TotalValue;               // �ƒ—˜‰v+�U•ª‹‹—^�·Šz
+                // �ƒ—˜‰v-�U•ª‹‹—^�·Šz
+                int TotalValue = TotalSalary - OnSalary;
+                wrkArray[(int)DBGetData.NetProfit] -= TotalValue;
                 // ------------------------------------------------------------------------------------------
 
                 // ------ �U•ª‹‹—^‚ðŽæ“¾‚·‚é
                 int[] CostValue3 = new int[2];
-
-                // �U•ª‹àŠz‚ðŽæ“¾‚·‚é
-                GetPersonAuxiliaryCostValue(DepartmentCode, PersonCode, ref CostValue3);
-                // ‰ÁŽZ
-                wrkArray[(int)DBGetData.NetProfit] += CostValue3.Sum();         // �ƒ—˜‰v
+                // •â�•�lŒ�”ï�U•ª‹àŠz‚ðŽæ“¾‚·‚é
+                CommonLedgerData.GetPersonAuxiliaryCostValue(TargetYear, DepartmentCode, PersonCode, ref CostValue3);
+                // �ƒ—˜‰v‰ÁŽZ
+                wrkArray[(int)DBGetData.NetProfit] += CostValue3.Sum();
                 // ------------------------------------------------------------------------------------------
                 // ‘S‘Ì•\Ž¦Žž�A‘S‚Ä‚O‚Í•\Ž¦‚µ‚È‚¢
                 if (PersonCode == 0 && wrkArray.Sum() == 0) { return; }
@@ -698,82 +688,25 @@
         }
         #endregion
 
-        #region •”��–ˆ‚Ì•â�•�U•ª‚ðŽæ“¾‚·‚é
+        #region ‰æ–ÊƒNƒŠƒA
         /// <summary>
-        /// •”��–ˆ‚Ì•â�•�U•ª‚ðŽæ“¾‚·‚é
+        /// ‰æ–ÊƒNƒŠƒA
         /// </summary>
-        /// <param name="PersonCDArray"></param>
-        /// <param name="CostValue"></param>
-        private void GetPersonAuxiliaryCostValue(int DepartmentCode, int PersonCode, ref int[] CostValue)
+        private void ClearDisplay()
         {
-            IOConstructionLedgerDetail DetailDB = new IOConstructionLedgerDetail();
             try
             {
-                int NotOrder = CommonDefine.ProjectsStatus.First(x => x.Value.Equals("”ñ Žó ’�")).Key;
-
-                // �HŽ–�Ú�×‘ä’ ƒf�[ƒ^‚æ‚è•â�•�U•ª‚ðŽæ“¾‚·‚é
-                StringBuilder strSQL = new StringBuilder();
-                strSQL.Append("SELECT A.CONSTRUCTIONPERIOD, P.GROUPCOUNT, SUM(B.PAYMENTAMOUNT)");
-                strSQL.Append(" FROM CONSTRUCTIONLEDGERDETAIL P LEFT JOIN CONSTRUCTIONLEDGEREXCUTE B");
-                strSQL.Append(" ON B.CONSTRUCTIONCODE = P.CONSTRUCTIONCODE AND B.GROUPCOUNT = P.GROUPCOUNT AND B.LINECOUNT = P.LINECOUNT");
-                strSQL.Append(", CONSTRUCTIONBASEINFO A");
-                strSQL.AppendFormat(" WHERE P.GROUPCOUNT IN ({0}, {1})"
-                                                , (int)FrmConstructionLedger.DataGroup.Instructor
-                                                , (int)FrmConstructionLedger.DataGroup.Assistant);
-
-                strSQL.Append(" AND P.COMPANYCODE IN (SELECT P1.PERSONCODE FROM PERSONINCHARGEMASTER P1");
-                strSQL.Append(" WHERE (P1.DELETEFLG = 0 OR P1.DELETEFLG = 1)");
-
-                if (CommonMotions.LoginUserData.PersonCode != CommonDefine.AdminCode)
+                foreach(Control CurCtrl in pnlPayroll.Controls)
                 {
-                    strSQL.Append(" AND P1.DEPARTMENTCODE IN (select PDep.DepartmentCode from PersonDepartmentMaster AS PDep");
-                    strSQL.AppendFormat(" WHERE PDep.PersonCode = {0})", CommonMotions.LoginUserData.PersonCode);
+                    if (CurCtrl.Name.IndexOf("lbl") < 0) continue;
+                    CurCtrl.Text = string.Empty;
                 }
-
-                //if (DepartmentCode != 0) strSQL.AppendFormat(" AND P1.DEPARTMENTCODE = {0}", DepartmentCode);
-                //if (PersonCode != 0) strSQL.AppendFormat(" AND P1.PERSONCODE = {0}", PersonCode);
-                if (DepartmentCode != 0)
-                {
-                    strSQL.AppendFormat(" AND (A.ConstrSubDepCode = {0}", DepartmentCode);
-                    strSQL.AppendFormat(" Or A.ConstrInstrDepCode = {0})", DepartmentCode);
-                }
-                if (PersonCode != 0)
-                {
-                    strSQL.AppendFormat(" AND (A.ConstrSubPersonCode = {0}", PersonCode);
-                    strSQL.AppendFormat(" Or  A.ConstructionInstructor = {0})", PersonCode);
-                }
-
-                strSQL.Append(" )");
-
-                strSQL.Append(" AND P.CONSTRUCTIONCODE = A.CONSTRUCTIONCODE");
-                strSQL.AppendFormat(" AND A.CONSTRUCTIONSTATUSFLG <> {0}", NotOrder);
-                strSQL.AppendFormat(" AND A.CONSTRUCTIONPERIOD = {0}", numUDConstPro.Value);
-                strSQL.Append(" GROUP BY A.CONSTRUCTIONPERIOD, P.GROUPCOUNT");
-
-                ArrayList arList = new ArrayList();
-                if (!DetailDB.ExecuteReader(strSQL.ToString(), ref arList)) return;
-
-                // Žæ“¾Œ‹‰Ê‚ð�U‚è•ª‚¯‚é
-                foreach (object[] wrkobj in arList)
-                {
-                    if (CommonMotions.cnvInt(wrkobj[1]) == (int)FrmConstructionLedger.DataGroup.Assistant)
-                    {
-                        CostValue[0] = CommonMotions.cnvInt(wrkobj[2]);
-                    }
-                    else
-                    {
-                        CostValue[1] = CommonMotions.cnvInt(wrkobj[2]);
-                    }
-                }
+                dgvMaster.Rows.Clear();
             }
             catch (Exception ex)
             {
                 logger.ErrorFormat("ƒVƒXƒeƒ€ƒGƒ‰�[�F{0}�F{1}", CommonMotions.GetMethodName(), ex.Message);
             }
-            finally
-            {
-                DetailDB.close(); DetailDB = null;
-            }
         }
         #endregion
 
@@ -802,7 +735,7 @@
 
                 // ----- ’S“–ŽÒ–ˆ‚ÌŽw’èŠú‚ÌŠJŽn�E�I—¹”NŒŽ“ú‚ðŽæ“¾‚·‚é
                 ArrayList TargetList = new ArrayList();
-                CreateLedgerSQL.GetPersonInDepartment((int)numUDConstPro.Value,
+                CommonLedgerData.GetPersonInDepartment((int)numUDConstPro.Value,
                                                     GetDepartmentCode(),
                                                     0,
                                                     ref TargetList);
@@ -813,8 +746,7 @@
 
                 // ‘Î�Û‚ÌŒo‰ß‹‹—^‚ðŽæ“¾‚·‚é
                 List<SalaryClass> ArrarySalary = new List<SalaryClass>();
-                //CreateLedgerSQL.GetElapsedSalary(SalaryDB, (int)numUDConstPro.Value, TargetList, ref ArrarySalary);
-                CreateLedgerSQL.GetElapsedSalaryAll(SalaryDB, (int)numUDConstPro.Value, ref TargetList, ref ArrarySalary);
+                CommonLedgerData.GetElapsedSalaryAll(SalaryDB, (int)numUDConstPro.Value, ref TargetList, ref ArrarySalary);
 
                 // ProgressBar‚Ì’l‚ð•Ï�X‚·‚é
                 prgber.Value++;
@@ -822,8 +754,7 @@
 
                 // ‘Î�Û‚ÌŒo”ï‚ðŽæ“¾‚·‚é
                 List<PersonExpensesCost> ArraryCost = new List<PersonExpensesCost>();
-                //CreateLedgerSQL.GetPersonExpensesCostValue(CostDB, (int)numUDConstPro.Value, ArrarySalary, ref ArraryCost);
-                CreateLedgerSQL.GetPersonExpensesCostValueAll(CostDB, (int)numUDConstPro.Value, ArrarySalary, ref ArraryCost);
+                CommonLedgerData.GetPersonExpensesCostValueAll(CostDB, (int)numUDConstPro.Value, ArrarySalary, ref ArraryCost);
 
                 // ProgressBar‚Ì’l‚ð•Ï�X‚·‚é
                 prgber.Value++;
@@ -1261,7 +1192,6 @@
                 int DepartmentCode = GetDepartmentCode();
 
                 int TotalSalary = 0;        // ‹‹—^—Ý�ÏŽæ“¾
-                int OnSalary = 0;           // �U•ª‹‹—^‹àŠzŽæ“¾
 
                 DateTime stDate = DateTime.Today;
                 DateTime edDate = DateTime.Today;
@@ -1272,11 +1202,11 @@
                 foreach (object[] ObjRec in TargetList)
                 {
                     // ŠJŽn�E�I—¹“ú‚ª–³‚¢�ê�‡‚ÍƒfƒtƒHƒ‹ƒg‚ÌŠúŽñ�EŠú––‚ðŽg—p‚·‚é
-                    stDate = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.StartDate]);
-                    edDate = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.CompDate]);
+                    stDate = CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.StartDate]);
+                    edDate = CommonMotions.cnvDate(ObjRec[(int)CommonLedgerData.GetPersonTerm.CompDate]);
 
                     // ‹‹—^—Ý�ÏŽæ“¾
-                    int nPersonCode = CommonMotions.cnvInt(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.PersonCode]);
+                    int nPersonCode = CommonMotions.cnvInt(ObjRec[(int)CommonLedgerData.GetPersonTerm.PersonCode]);
 
                     // ‹‹—^—Ý�ÏŽæ“¾
                     TotalSalary += ArrarySalary.Where(x => x.PersonCode == nPersonCode).Sum(y => y.SalaryValue);
@@ -1288,8 +1218,9 @@
 
 
                 // ----- •\Ž¦�ˆ—�
+                int OnSalary = 0;           // �U•ª‹‹—^‹àŠzŽæ“¾
                 // �U•ª‹‹—^‹àŠz
-                CreateLedgerSQL.ProfitGeneral(LedgerDB, (int)numUDConstPro.Value, DepartmentCode, 0, ref OnSalary, false);
+                CommonLedgerData.ProfitGeneral(LedgerDB, (int)numUDConstPro.Value, DepartmentCode, 0, ref OnSalary, false);
 
                 // �U•ª‹‹—^‹àŠz•\Ž¦
                 lblCalcValue1.Text = OnSalary.ToString("#,0");
@@ -1302,9 +1233,10 @@
                 lblTotalValue.Text = TotalValue.ToString("#,0");
                 lblCalcValue3.Text = TotalValue.ToString("#,0");
 
-                // �U•ª‹àŠz‚ðŽæ“¾‚·‚é
+                // •â�•�U•ª‹àŠz‚ðŽæ“¾‚·‚é
                 int[] CostValue = new int[2];
-                GetPersonAuxiliaryCostValue(DepartmentCode, 0, ref CostValue);
+                int TargetYear = (int)numUDConstPro.Value;
+                CommonLedgerData.GetPersonAuxiliaryCostValue(TargetYear, DepartmentCode, 0, ref CostValue);
 
                 // •›’S“–ŽÒŽû‰v‹àŠz•\Ž¦
                 lblCalcValue2.Text = CostValue[0].ToString("#,0");
@@ -1404,5 +1336,185 @@
             }
         }
         #endregion
+
+        // ----------------- ƒfƒoƒbƒOƒ�ƒWƒbƒN
+        #region �ÄŒvŽZ�ˆ—�
+        /// <summary>
+        /// �ÄŒvŽZ�ˆ—�
+        /// </summary>
+        private void ReCalculate()
+        {
+            IOConstructionBaseInfo BaseDB = new IOConstructionBaseInfo();
+            try
+            {
+                MessageBox.Show("�ÄŒvŽZ�ˆ—�‚ðŠJŽn‚µ‚Ü‚·�B");
+
+                StringBuilder strSQL = new StringBuilder();
+                strSQL.Append("Select");
+                strSQL.Append(" ConstructionCode");
+                strSQL.Append(" From");
+                strSQL.Append(" constructionbaseinfo");
+                strSQL.Append(" Where");
+                strSQL.Append(" ConstructionPeriod = 17");
+                strSQL.Append(" And ConstructionStatusFlg != 11");
+                strSQL.Append(" Order By ConstructionCode");
+
+                ArrayList arData = new ArrayList();
+                BaseDB.ExecuteReader(strSQL.ToString(), ref arData);
+
+                foreach (object[] curdata in arData)
+                {
+                    FrmConstructionLedger frm = new FrmConstructionLedger();                    // �HŽ–�Ú�×‘ä’ “ü—Í
+                    // �HŽ–ƒR�[ƒh‚ÌƒZƒbƒg
+                    frm.ConstructionCode = CommonMotions.cnvInt(curdata[0]);
+
+                    // Œ©‚¦‚È‚¢‰æ–Ê‚ð�o‚·
+                    frm.Hide();
+
+                    // �ÄŒvŽZ�ˆ—�
+                    bool bret = frm.RecalculateLedger;
+
+                    // ‰æ–Ê‚ð•Â‚¶‚é
+                    frm.Close();
+                    frm.Dispose(); frm = null;
+                }
+                MessageBox.Show("�ÄŒvŽZ�ˆ—�‚ª�I—¹‚µ‚Ü‚µ‚½�B");
+            }
+            catch (Exception ex)
+            {
+                logger.ErrorFormat("ƒVƒXƒeƒ€ƒGƒ‰�[�F{0}�F{1}", CommonMotions.GetMethodName(), ex.Message);
+                MessageBox.Show("�ÄŒvŽZ�ˆ—�‚ªƒAƒ{�[ƒg‚µ‚Ü‚µ‚½�B");
+            }
+            finally
+            {
+                BaseDB.close(); BaseDB = null;
+            }
+        }
+        #endregion
+
+        #region �HŽ–‘ä’ •”��ƒR�[ƒhƒZƒbƒg�ˆ—�
+        /// <summary>
+        /// �HŽ–‘ä’ •”��ƒR�[ƒhƒZƒbƒg�ˆ—�
+        /// </summary>
+        private void SetDepartmentCode()
+        {
+            IOMPersonInCharge PersonDB = new IOMPersonInCharge();
+            IOConstructionLedgerDetail LdDB = new IOConstructionLedgerDetail();
+            try
+            {
+                MessageBox.Show("•ÏŠ·�ˆ—�ŠJŽn");
+
+                List<PersonInChargeMaster> PersonList = new List<PersonInChargeMaster>();
+                PersonDB.SelectAction("", ref PersonList);
+
+                LdDB.connect();LdDB.beginTran();
+                StringBuilder strSQL = new StringBuilder();
+                List<ConstructionLedgerDetail> DetailList = new List<ConstructionLedgerDetail>();
+                foreach (PersonInChargeMaster CurRec in PersonList)
+                {
+                    strSQL.Clear();
+                    strSQL.Append(" where CompanyType = 2 AND GroupCount IN(11, 10, 9)");
+                    strSQL.AppendFormat(" And CompanyCode = {0}", CurRec.PersonCode);
+                    DetailList.Clear();
+                    if (!LdDB.SelectAction(strSQL.ToString(), ref DetailList, false)) continue;
+                    if (DetailList.Count < 1) continue;
+
+                    strSQL.Clear();
+                    strSQL.Append("update constructionledgerdetail");
+                    strSQL.AppendFormat(" set ComponentCode = {0}", CurRec.DepartmentCode);
+                    strSQL.Append(" where CompanyType = 2 AND GroupCount IN(11, 10, 9)");
+                    strSQL.AppendFormat(" And CompanyCode = {0}",CurRec.PersonCode);
+
+                    if(!LdDB.ExecuteNonQuery(strSQL.ToString(),false))
+                    {
+                        LdDB.rollback();
+                        MessageBox.Show("ˆêŠ‡�X�VƒGƒ‰�[");
+                        return;
+                    }
+                }
+                strSQL.Clear();
+                // ’†”öŽ�:17
+                strSQL.Append("update constructionledgerdetail As A, constructionbaseinfo As B");
+                strSQL.Append(" set ComponentCode = 3");
+                strSQL.Append(" where CompanyType = 2 AND GroupCount IN(11, 10, 9)");
+                strSQL.Append(" And CompanyCode = 20010104");
+                strSQL.Append(" AND B.CONSTRUCTIONCODE = A.CONSTRUCTIONCODE");
+                strSQL.Append(" And B.CONSTRUCTIONPERIOD <= 17");
+                LdDB.ExecuteNonQuery(strSQL.ToString(), false);
+
+                // ‘å’JŽ�:17
+                strSQL.Clear();
+                strSQL.Append("update constructionledgerdetail As A, constructionbaseinfo As B");
+                strSQL.Append(" set ComponentCode = 3");
+                strSQL.Append(" where CompanyType = 2 AND GroupCount IN(11, 10, 9) And CompanyCode = 20160602");
+                strSQL.Append(" AND B.CONSTRUCTIONCODE = A.CONSTRUCTIONCODE");
+                strSQL.Append(" And B.CONSTRUCTIONPERIOD <= 17");
+                LdDB.ExecuteNonQuery(strSQL.ToString(), false);
+
+                // •Ä“cŽ�:17
+                strSQL.Clear();
+                strSQL.Append("update constructionledgerdetail As A, constructionbaseinfo As B");
+                strSQL.Append(" set ComponentCode = 9");
+                strSQL.Append(" where CompanyType = 2 AND GroupCount IN(11, 10, 9)");
+                strSQL.Append(" And CompanyCode = 20160901");
+                strSQL.Append(" AND B.CONSTRUCTIONCODE = A.CONSTRUCTIONCODE");
+                strSQL.Append(" And B.CONSTRUCTIONPERIOD <= 17");
+                LdDB.ExecuteNonQuery(strSQL.ToString(), false);
+
+                // �¬�ìŽ�:17
+                strSQL.Clear();
+                strSQL.Append("update constructionledgerdetail As A, constructionbaseinfo As B");
+                strSQL.Append(" set ComponentCode = 9");
+                strSQL.Append(" where CompanyType = 2 AND GroupCount IN(11, 10, 9)");
+                strSQL.Append(" And CompanyCode = 20160601");
+                strSQL.Append(" AND B.CONSTRUCTIONCODE = A.CONSTRUCTIONCODE");
+                strSQL.Append(" And B.CONSTRUCTIONPERIOD <= 17");
+                LdDB.ExecuteNonQuery(strSQL.ToString(), false);
+
+                // ‘å’JŽ�:16
+                strSQL.Clear();
+                strSQL.Append("update constructionledgerdetail As A, constructionbaseinfo As B");
+                strSQL.Append(" set ComponentCode = 1");
+                strSQL.Append(" where CompanyType = 2 AND GroupCount IN(11, 10, 9)");
+                strSQL.Append(" And CompanyCode = 20160602");
+                strSQL.Append(" AND B.CONSTRUCTIONCODE = A.CONSTRUCTIONCODE");
+                strSQL.Append(" And B.CONSTRUCTIONPERIOD <= 16");
+                LdDB.ExecuteNonQuery(strSQL.ToString(), false);
+
+                // �¬”¨Ž�:16
+                strSQL.Clear();
+                strSQL.Append("update constructionledgerdetail As A, constructionbaseinfo As B");
+                strSQL.Append(" set ComponentCode = 1");
+                strSQL.Append(" where CompanyType = 2 AND GroupCount IN(11, 10, 9)");
+                strSQL.Append(" And CompanyCode = 20160701");
+                strSQL.Append(" AND B.CONSTRUCTIONCODE = A.CONSTRUCTIONCODE");
+                strSQL.Append(" And B.CONSTRUCTIONPERIOD <= 16");
+                LdDB.ExecuteNonQuery(strSQL.ToString(), false);
+
+                // �KŽ�:16
+                strSQL.Clear();
+                strSQL.Append("update constructionledgerdetail As A, constructionbaseinfo As B");
+                strSQL.Append(" set ComponentCode = 2");
+                strSQL.Append(" where CompanyType = 2 AND GroupCount IN(11, 10, 9)");
+                strSQL.Append(" And CompanyCode = 20150701");
+                strSQL.Append(" AND B.CONSTRUCTIONCODE = A.CONSTRUCTIONCODE");
+                strSQL.Append(" And B.CONSTRUCTIONPERIOD <= 16");
+                LdDB.ExecuteNonQuery(strSQL.ToString(), false);
+
+                LdDB.commit();
+
+                MessageBox.Show("•ÏŠ·�ˆ—��I—¹");
+            }
+            catch (Exception ex)
+            {
+                logger.ErrorFormat("ƒVƒXƒeƒ€ƒGƒ‰�[�F{0}�F{1}", CommonMotions.GetMethodName(), ex.Message);
+            }
+            finally
+            {
+                PersonDB.close(); PersonDB = null;
+                LdDB.close(); LdDB = null;
+            }
+        }
+        #endregion
     }
 }
\ No newline at end of file
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Material/ConstrMATLList/FrmConstrMATLListAuxiliary.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Material/ConstrMATLList/FrmConstrMATLListAuxiliary.cs	(revision 343)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Material/ConstrMATLList/FrmConstrMATLListAuxiliary.cs	(revision 344)
@@ -1096,6 +1096,7 @@
             {
                 cmbConstructionPerson.SelectedIndexChanged -= new EventHandler(cmbConstructionPerson_SelectedIndexChanged);
                 int nBeforeCode = CommonMotions.cnvInt(cmbConstructionPerson.SelectedValue);
+                if (CommonMotions.cnvInt(cmbDepartment.SelectedValue) < 1) nBeforeCode = 0;
 
                 cmbConstructionPerson.DataSource = null;
                 cmbConstructionPerson.Items.Clear();
@@ -1175,9 +1176,10 @@
                 PersonRec.DepartmentCode = CommonMotions.cnvInt(objRec[2]);     // •”��ƒR�[ƒh
 
                 // “¯‚¶•”��‚Ì�ê�‡‚Í�ˆ—�‚µ‚È‚¢
-                if (DepartmentCode == PersonRec.DepartmentCode) return true;
+                //if (DepartmentCode == PersonRec.DepartmentCode) return true;
 
                 // •”��ƒRƒ“ƒ{ƒ{ƒbƒNƒX‚Ö•”��ƒR�[ƒhƒZƒbƒg
+                SetcmbDepartment();
                 cmbDepartment.SelectedValue = PersonRec.DepartmentCode;
                 SetcmbPersons();    // ’S“–ŽÒƒRƒ“ƒ{ƒ{ƒbƒNƒX•Ï�X
                 cmbConstructionPerson.SelectedValue = PersonCode;
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/PriceOfBudget/FrmPriceOfBudgetAuxiliary.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/PriceOfBudget/FrmPriceOfBudgetAuxiliary.cs	(revision 343)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/PriceOfBudget/FrmPriceOfBudgetAuxiliary.cs	(revision 344)
@@ -61,6 +61,9 @@
                 // ‘ä’ –¢�ì�¬ƒf�[ƒ^•\Ž¦�ˆ—�
                 SetNotCreateRowData(DepExpList, ref nConstrCodeList, ref ExpNameList, ref TotalArea);
 
+                // ‘ä’ –¢�I—¹ƒf�[ƒ^•\Ž¦�ˆ—�
+                SetNotComplateRowData(ExpNameList);
+
                 // ‘ä’ ƒf�[ƒ^•\Ž¦
                 SetCreateRowData(ExpNameList, ref TotalArea);
 
@@ -266,8 +269,8 @@
                     return;
                 }
 
-                // �ˆ—�‘Î�ÛƒŠƒXƒg�ì�¬
-                GetProcList(DataArList, ref nConstrCodeList);
+                // –¢�ì�¬�ˆ—�‘Î�ÛƒŠƒXƒg�ì�¬
+                NotCreateGetProcList(DataArList, ref nConstrCodeList);
 
                 DataGridView dgv = dgvMain;
                 dgv.Rows.Clear();
@@ -361,6 +364,195 @@
         }
         #endregion
 
+        #region ‘ä’ –¢�I—¹ƒf�[ƒ^•\Ž¦�ˆ—�
+        /// <summary>
+        /// ‘ä’ –¢�I—¹ƒf�[ƒ^•\Ž¦�ˆ—�
+        /// </summary>
+        /// <param name="ExpList"></param>
+        private void SetNotComplateRowData(List<KeyValuePair<int, string>> ExpList)
+        {
+            IOConstructionBaseInfo BaseDB = new IOConstructionBaseInfo();
+            try
+            {
+                int SelectPeriod = (int)numUDConstPro.Value;
+                // ƒRƒ“ƒ{ƒ{ƒbƒNƒX‚æ‚è‘I‘ð•”��‚ðŽæ“¾‚·‚é
+                int DepartmantCode = GetDepartmentCode();
+                // ƒRƒ“ƒ{ƒ{ƒbƒNƒX‚æ‚è‘I‘ð’S“–ŽÒ‚ðŽæ“¾‚·‚é
+                int PersonCode = GetConstructionPersonCode();
+
+
+                int nStatCode = CommonDefine.ProjectsStatus.First(x => x.Value.Equals("�¿‹�Šm”F")).Key;
+
+                #region Žæ“¾‚r‚p‚k
+                StringBuilder strSQL = new StringBuilder();
+                strSQL.Append("SELECT");
+                strSQL.Append(" C1.DISPLAYORDER AS DepDisp");
+                strSQL.Append(", C1.DepartmentCode AS DepCode");
+                strSQL.Append(", A1.DetailString As DepName");
+                strSQL.Append(", A.CONSTRUCTIONCODE As ConstrCode");
+                strSQL.Append(", E1.DETAILSTRING As ConstrName");
+                strSQL.Append(", B1.DISPLAYORDER AS ManDisp");
+                strSQL.Append(", A.CONSTRUCTIONPERSONCODE As ManCode");
+                strSQL.Append(", B1.PERSONNAME As ManName");
+                strSQL.Append(", CASE");
+                strSQL.Append(" WHEN DATE(A.ORDERDATE) = DATE('0001/01/01')");
+                strSQL.Append(" Then A.ProvisionalOrderDate");
+                strSQL.Append(" Else A.ORDERDATE");
+                strSQL.Append(" End As ORDERDATE");
+                strSQL.Append(", ifNull(Ledger.OrdersDecisionPrice, A.ORDERSDECISIONPRICE) As OrValue");
+                strSQL.Append(", A.CONSTRUCTIONSTATUSFLG As Stat");
+                strSQL.Append(", ExpName.DisplayOrder AS ExpDisp");
+                strSQL.Append(", ChgExp.NameCode As ExpCode");
+                strSQL.Append(", ExpName.NameString As ExpName");
+                strSQL.Append(", ChgExp.ExpensesValue");
+                strSQL.Append(", ChgExp.ExpensesRaito");
+                strSQL.Append(" FROM");
+                strSQL.Append("   constructionledger AS Ledger");
+                strSQL.Append("   Inner Join CONSTRUCTIONBASEINFO AS A");
+                strSQL.Append("          On A.CONSTRUCTIONCODE = Ledger.CONSTRUCTIONCODE");
+
+                strSQL.Append("   INNER JOIN CONSTRUCTIONBASEINFODETAIL AS E1");
+                strSQL.Append("          On E1.CONSTRUCTIONCODE = A.CONSTRUCTIONCODE");
+                strSQL.AppendFormat("    AND E1.DETAILNO = {0}", (int)ConstructionBaseInfoDetail.DataNoDef.ConstructionName);
+
+                strSQL.Append("   LEFT JOIN CONSTRUCTIONBASEINFODETAIL AS A1");
+                strSQL.Append("         ON A1.ConstructionCode = A.ConstructionCode");
+                strSQL.AppendFormat("   And A1.DetailNo = {0}", (int)ConstructionBaseInfoDetail.DataNoDef.ConstrDepartmentName);
+
+                strSQL.Append("   LEFT JOIN constrledgerexpenses AS ChgExp");
+                strSQL.Append("         ON ChgExp.ConstructionCode = A.ConstructionCode");
+
+                strSQL.Append("   LEFT JOIN divisionmaster AS ExpName");
+                strSQL.AppendFormat("   ON ExpName.DivisionCode = {0}", (int)DivisionMaster.DivisionMasterCodeDef.ConstructionExpenses);
+                strSQL.Append("         And ExpName.NameCode = ChgExp.NameCode");
+
+                strSQL.Append("   LEFT JOIN DEPARTMENTMASTER AS C1");
+                strSQL.Append("         On C1.DEPARTMENTCODE = A.ConstrDepCode");
+
+                strSQL.Append("   LEFT JOIN PERSONINCHARGEMASTER AS B1");
+                strSQL.Append("         On B1.PERSONCODE = A.CONSTRUCTIONPERSONCODE");
+
+                strSQL.Append(" WHERE");
+                strSQL.AppendFormat(" A.CONSTRUCTIONPERIOD = {0}", SelectPeriod);
+                strSQL.AppendFormat(" AND A.TYINGFLG != {0}", (int)ConstructionBaseInfo.TyingFlgDef.Tying);
+                strSQL.AppendFormat(" AND A.JOINFLG != {0}", (int)ConstructionBaseInfo.JoinFlgDef.JoinChildren);
+                strSQL.AppendFormat(" AND A.ConstructionStatusFlg = {0}", nStatCode);
+                strSQL.AppendFormat(" AND Ledger.ComplateFlg = {0}",(int)ConstructionLedger.CompFlagDef.Operateing);
+
+                if (DepartmantCode > 0)
+                {
+                    strSQL.AppendFormat(" AND A.ConstrDepCode = {0}", DepartmantCode);
+                    strSQL.AppendFormat(" And A1.DetailString = '{0}'", cmbDepartment.Text);
+                }
+
+                if (PersonCode > 0) strSQL.AppendFormat(" AND A.CONSTRUCTIONPERSONCODE = {0}", PersonCode);
+
+                strSQL.Append(" ORDER BY DepDisp, ManDisp, ConstrCode, ExpDisp");
+                #endregion
+
+                ArrayList DataArList = new ArrayList();
+                if (!BaseDB.ExecuteReader(strSQL.ToString(), ref DataArList)) return;
+                if (DataArList.Count == 0) return;
+
+                DataGridView dgv = dgvMain;
+                // –¢�I—¹�ˆ—�‘Î�ÛƒŠƒXƒg�ì�¬
+                List<int> nConstrCodeList = new List<int>();
+                NotComplateGetProcList(DataArList, ref nConstrCodeList);
+
+                int ino = 1;
+                object[] FirstWork = (object[])DataArList[0];
+                string strBreakDep = CommonMotions.cnvString(FirstWork[(int)GetDataEnum.DepName]);
+                foreach (int execCode in nConstrCodeList)
+                {
+                    var TargetData = DataArList.Cast<object[]>().Where(x => CommonMotions.cnvInt(x[(int)GetDataEnum.ConstrCode]) == execCode).ToArray();
+
+                    DataGridViewRow dgvRow = null;
+                    bool bFirst = true;
+                    foreach(object[] ObjRec in TargetData)
+                    {
+                        if (bFirst)
+                        {
+                            // •”��‚ªˆá‚¦‚Î1�sŠJ‚¯‚é
+                            string strDepName = CommonMotions.cnvString(ObjRec[(int)GridColumn.DepartmentName]);
+                            if (strBreakDep != strDepName) dgv.Rows.Add(1);
+                            strBreakDep = strDepName;
+
+                            int RowIndex = dgv.Rows.Add(1);
+                            dgvRow = dgv.Rows[RowIndex];
+
+                            // ƒf�[ƒ^‚ðƒZƒbƒg‚·‚é
+                            dgvRow.Cells[(int)GridColumn.No].Value = ino++;                                                 // 
+                            // 0:•”��ƒR�[ƒh
+                            dgvRow.Cells[(int)GridColumn.DepartmentCode].Value = ObjRec[(int)GetDataEnum.DepCode];
+                            // 1:•”��–¼
+                            dgvRow.Cells[(int)GridColumn.DepartmentName].Value = ObjRec[(int)GetDataEnum.DepName];
+                            // 2:’S“–ŽÒ–¼
+                            dgvRow.Cells[(int)GridColumn.PersonName].Value = ObjRec[(int)GetDataEnum.ManName];
+                            // 3:�HŽ–”Ô�†
+                            dgvRow.Cells[(int)GridColumn.ConstrCode].Value = ObjRec[(int)GetDataEnum.ConstrCode];
+                            // 4:�HŽ––¼�Ì                 
+                            dgvRow.Cells[(int)GridColumn.ConstrName].Value = ObjRec[(int)GetDataEnum.ConstrName];
+                            // 5:Žó’�“ú
+                            dgvRow.Cells[(int)GridColumn.OrderDate].Value =
+                                CommonMotions.cnvDate(ObjRec[(int)GetDataEnum.OrderDate]).ToShortDateString();
+                            // 6:Ž{�H�ó‘Ô
+                            int nStat = CommonMotions.cnvInt(ObjRec[(int)GetDataEnum.Stat]);
+                            dgvRow.Cells[(int)GridColumn.ConstrStatus].Value = CommonDefine.ProjectsStatus[nStat];
+                            // 7:Žó’�‹àŠz
+                            dgvRow.Cells[(int)GridColumn.OrdersPrice].Value = CommonMotions.cnvInt(ObjRec[(int)GetDataEnum.OrValue]).ToString("#,0");
+                        }
+
+                        int nIndex = 0;
+                        foreach (KeyValuePair<int,string> CurPair in ExpList)
+                        {
+                            ++nIndex;
+                            if (CurPair.Key != CommonMotions.cnvInt(ObjRec[(int)GetDataEnum.ExpCode])) continue;
+                            dgvRow.Cells[(int)GridColumn.OrdersPrice + nIndex].Value = CommonMotions.cnvInt(ObjRec[(int)GetDataEnum.ExpRaito]).ToString("#,0");
+                            break;
+                        }
+
+                        bFirst = false;
+                    }
+                }
+            }
+            catch (System.Exception ex)
+            {
+                logger.ErrorFormat("ƒVƒXƒeƒ€ƒGƒ‰�[�F{0}�F{1}", CommonMotions.GetMethodName(), ex.Message);
+            }
+            finally
+            {
+                BaseDB.close(); BaseDB = null;
+            }
+        }
+        #endregion
+
+        #region –¢�I—¹�ˆ—�‘Î�ÛƒŠƒXƒg�ì�¬
+        /// <summary>
+        /// –¢�I—¹�ˆ—�‘Î�ÛƒŠƒXƒg�ì�¬
+        /// </summary>
+        private void NotComplateGetProcList(ArrayList DatArList, ref List<int> nConstrCodeList)
+        {
+            try
+            {
+                int BKey1 = 0;
+                foreach (object[] objRec in DatArList)
+                {
+                    // ‘Î�Û�HŽ–‚ðƒŠƒXƒg‰»‚·‚é
+                    int nCode = CommonMotions.cnvInt(objRec[(int)GetDataEnum.ConstrCode]);
+                    if (BKey1 != nCode)
+                    {
+                        nConstrCodeList.Add(nCode);
+                        BKey1 = nCode;
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                logger.ErrorFormat("ƒVƒXƒeƒ€ƒGƒ‰�[�F{0}�F{1}", CommonMotions.GetMethodName(), ex.Message);
+            }
+        }
+        #endregion
+
         #region Žó’��ó‹µˆê——•\Ž¦—pƒf�[ƒ^Žæ“¾SQL�ì�¬
         /// <summary>
         /// Žó’��ó‹µˆê——•\Ž¦—pƒf�[ƒ^Žæ“¾SQL�ì�¬
@@ -397,11 +589,11 @@
         }
         #endregion
 
-        #region �ˆ—�‘Î�ÛƒŠƒXƒg�ì�¬
+        #region –¢�ì�¬�ˆ—�‘Î�ÛƒŠƒXƒg�ì�¬
         /// <summary>
-        /// �ˆ—�‘Î�ÛƒŠƒXƒg�ì�¬
+        /// –¢�ì�¬�ˆ—�‘Î�ÛƒŠƒXƒg�ì�¬
         /// </summary>
-        private void GetProcList(ArrayList DatArList, ref List<int> nConstrCodeList)
+        private void NotCreateGetProcList(ArrayList DatArList, ref List<int> nConstrCodeList)
         {
             try
             {
@@ -445,7 +637,7 @@
                 int nAddColCnt = ExpList.Count;
 
                 m_GridExpColList = new DataGridViewColumn[nAddColCnt];
-                m_GridExpCellStyleList=new DataGridViewCellStyle[nAddColCnt];
+                m_GridExpCellStyleList = new DataGridViewCellStyle[nAddColCnt];
                 for (int i = 0; i < nAddColCnt; i++)
                 {
                     // ƒXƒ^ƒCƒ‹�ì�¬
@@ -588,22 +780,40 @@
                 int iCode1 = CommonDefine.ProjectsStatus.First(x => x.Value.Equals("”ñ Žó ’�")).Key;
 
                 StringBuilder strSQL = new StringBuilder();
-                strSQL.Append("SELECT");
-                strSQL.Append(" A.COMPLATEFLG");
-                strSQL.Append(", SUM(A.ORDERSDECISIONPRICE)");
-                strSQL.Append(", SUM(A.COMPANYEXPENSES)");
-                strSQL.Append(", SUM(A.DEPARTMENTEXPENSES)");
-                strSQL.Append(", SUM(A.SALESEXPENSES)");
-                strSQL.Append(" FROM");
-                strSQL.Append(" CONSTRUCTIONLEDGER A");
-                strSQL.Append(", CONSTRUCTIONBASEINFO B");
-                strSQL.Append(" WHERE A.CONSTRUCTIONCODE = B.CONSTRUCTIONCODE"); ;
-                strSQL.AppendFormat(" AND B.CONSTRUCTIONPERIOD = {0}", SelectPeriod);
+                strSQL.Append("Select");
+                strSQL.Append(" OrderValue.COMPLATEFLG");
+                strSQL.Append(", ExpValue.ExpCode");
+                strSQL.Append(", OrderValue.OrderPrice");
+                strSQL.Append(", ExpValue.ExpPrice");
+                strSQL.Append(" From");
+                strSQL.Append("    (SELECT");
+                strSQL.Append("        A.COMPLATEFLG As COMPLATEFLG");
+                strSQL.Append("        , SUM(A.ORDERSDECISIONPRICE) As OrderPrice");
+                strSQL.Append("     FROM CONSTRUCTIONLEDGER AS A, CONSTRUCTIONBASEINFO AS B");
+                strSQL.Append("     WHERE");
+                strSQL.Append("        A.CONSTRUCTIONCODE = B.CONSTRUCTIONCODE");
+                strSQL.AppendFormat("  AND B.CONSTRUCTIONPERIOD = {0}", SelectPeriod);
+                strSQL.AppendFormat("  AND B.CONSTRUCTIONSTATUSFLG != {0}", iCode1);
+                strSQL.Append("     GROUP BY A.COMPLATEFLG) As OrderValue");
+                strSQL.Append(",   (SELECT");
+                strSQL.Append("        A.COMPLATEFLG As COMPLATEFLG");
+                strSQL.Append("        , D.NameCode As ExpCode");
+                strSQL.Append("        , SUM(D.ExpensesValue) As ExpPrice");
+                strSQL.Append("     FROM CONSTRUCTIONLEDGER AS A");
+                strSQL.Append("     INNER JOIN CONSTRUCTIONBASEINFO AS B");
+                strSQL.Append("            On A.CONSTRUCTIONCODE = B.CONSTRUCTIONCODE");
+                strSQL.Append("     LEFT JOIN CONSTRUCTIONLEDGERDETAIL AS C");
+                strSQL.Append("            ON C.ConstructionCode = A.ConstructionCode");
+                strSQL.AppendFormat("      And C.GroupCount = {0}", (int)FrmConstructionLedger.DataGroup.Expenses);
+                strSQL.Append("     LEFT JOIN constrledgerexpenses AS D");
+                strSQL.Append("           On D.ConstructionCode = A.ConstructionCode");
+                strSQL.Append("           And D.NameCode = C.ComponentCode");
+                strSQL.Append("     WHERE");
+                strSQL.AppendFormat("     B.CONSTRUCTIONPERIOD = {0}", SelectPeriod);
                 strSQL.AppendFormat(" AND B.CONSTRUCTIONSTATUSFLG != {0}", iCode1);
-                if (DepartmantCode != 0) strSQL.AppendFormat(" AND B.ConstrDepCode = {0}", DepartmantCode);
-                if (PersonCode != 0) strSQL.AppendFormat(" AND B.ConstructionPersonCode = {0}", PersonCode);
-                strSQL.Append(" GROUP BY A.COMPLATEFLG");
-                strSQL.Append(" ORDER BY 1");
+                strSQL.Append("     GROUP BY A.COMPLATEFLG, D.NameCode) As ExpValue");
+                strSQL.Append(" Where ExpValue.COMPLATEFLG = OrderValue.COMPLATEFLG");
+                strSQL.Append(" ORDER BY COMPLATEFLG, ExpCode");
 
                 ArrayList DatArList = new ArrayList();
                 if (!BaseDB.ExecuteReader(strSQL.ToString(), ref DatArList)) return;
@@ -612,52 +822,64 @@
                 // �‡ŒvƒGƒŠƒA�‰Šú‰»
                 int TotalColCnt = ExpList.Count + 1;
                 long[] CurTotalArea = new long[TotalColCnt];
+                // ƒf�[ƒ^�s�”Žæ“¾
+                int ArrayCount = Enum.GetNames(typeof(ConstructionLedger.CompFlagDef)).Length;
+                // ƒf�[ƒ^•\Ž¦
+                for (int i = 0; i < ArrayCount; i++)
+                {
+                    var CurData = DatArList.Cast<object[]>().Where(x => CommonMotions.cnvInt(x[0]) == i && CommonMotions.cnvInt(x[1]) > 0)
+                                                            .ToArray();
 
-                int CompFlg = -1;
-                int BreakKey = -1;
-                foreach (object[] objGetArry in DatArList)
-                {
-                    CompFlg = CommonMotions.cnvInt(objGetArry[0]);
-                    if (BreakKey != CompFlg)
+                    Array.Clear(CurTotalArea, 0, CurTotalArea.Length);
+                    if (CurData.Count() < 0)
                     {
-                        Array.Clear(CurTotalArea, 0, CurTotalArea.Length);
-                        BreakKey = CompFlg;
+                        // ƒf�[ƒ^‚ª–³‚¢�ê�‡‚Í‘«‚è‚È‚¢�‡Œv‚ð•\Ž¦‚·‚é
+                        switch (i)
+                        {
+                            case (int)ConstructionLedger.CompFlagDef.Operateing:
+                                DisplayTotalRow((int)RowTitleNum.DataType3, CurTotalArea);
+                                break;
+                            case (int)ConstructionLedger.CompFlagDef.Complated:
+                                InsertZeroTotalRow((int)RowTitleNum.DataType2, CurTotalArea);
+                                break;
+                        }
+                        continue;
                     }
 
-                    int OrdersDecisionPrice = CommonMotions.cnvInt(objGetArry[1]);      // Žó’�‹àŠz
-                    int ExpensesPrice1 = CommonMotions.cnvInt(objGetArry[2]);           // ‰ïŽÐŒo”ï
-                    int ExpensesPrice2 = CommonMotions.cnvInt(objGetArry[3]);           // •”��Œo”ï
-                    int ExpensesPrice3 = CommonMotions.cnvInt(objGetArry[4]);           // ‰c‹ÆŒo”ï
+                    foreach (object[] CurRec in CurData)
+                    {
+                        int CompFlg = CommonMotions.cnvInt(CurRec[0]);
+                        int ExpCode = CommonMotions.cnvInt(CurRec[1]);
 
-                    CurTotalArea[0] += OrdersDecisionPrice;   // Žó’�‹àŠz
-                    CurTotalArea[1] += ExpensesPrice1;     // ‰ïŽÐŒo”ï
-                    CurTotalArea[2] += ExpensesPrice2;  // •”��Œo”ï
-                    CurTotalArea[3] += ExpensesPrice3;      // ‰c‹ÆŒo”ï
+                        // Žó’�‹àŠz
+                        CurTotalArea[0] = CommonMotions.cnvInt(CurRec[2]);
 
+                        // �‡ŒvˆÊ’uŽæ“¾
+                        int nIndex = 0;
+                        // Œo”ïƒŠƒXƒg‚É–³‚¢�ê�‡‚ÍƒZƒbƒg‚µ‚È‚¢
+                        if (!ExpList.Exists(x => x.Key == ExpCode)) continue;
+
+                        for (int xx = 0; xx < ExpList.Count; xx++)
+                        {
+                            if (ExpList[xx].Key == ExpCode)
+                            {
+                                nIndex = xx + 1;
+                                break;
+                            }
+                        }
+
+                        // Œo”ï‚ÌƒZƒbƒg
+                        CurTotalArea[nIndex] = CommonMotions.cnvLong(CurRec[3]);
+                    }
                     // �‡Œv‰ÁŽZ
-                    for (int i = 0; i < TotalArea.Length; i++)
+                    for (int ii = 0; ii < TotalArea.Length; ii++)
                     {
-                        TotalArea[i] += CurTotalArea[i];
+                        TotalArea[ii] += CurTotalArea[ii];
                     }
 
                     // �‡Œv�s•\Ž¦
-                    DisplayTotalRow((CompFlg + 1), CurTotalArea);
+                    DisplayTotalRow((i + 1), CurTotalArea);
                 }
-                // ƒf�[ƒ^‚ª–³‚¢�ê�‡‚Í‘«‚è‚È‚¢�‡Œv‚ð•\Ž¦‚·‚é
-                int ArrayCount = Enum.GetNames(typeof(ConstructionLedger.CompFlagDef)).Length;
-                if (DatArList.Count < ArrayCount)
-                {
-                    Array.Clear(CurTotalArea, 0, CurTotalArea.Length);
-                    switch (CompFlg)
-                    {
-                        case (int)ConstructionLedger.CompFlagDef.Operateing:
-                            DisplayTotalRow((int)RowTitleNum.DataType3, CurTotalArea);
-                            break;
-                        case (int)ConstructionLedger.CompFlagDef.Complated:
-                            InsertZeroTotalRow((int)RowTitleNum.DataType2, CurTotalArea);
-                            break;
-                    }
-                }
             }
             catch (System.Exception ex)
             {
@@ -835,6 +1057,7 @@
             {
                 this.cmbConstructionPerson.SelectedIndexChanged -= new System.EventHandler(this.cmbConstructionPerson_SelectedIndexChanged);
                 int nBeforeCode = CommonMotions.cnvInt(cmbConstructionPerson.SelectedValue);
+                if (CommonMotions.cnvInt(cmbDepartment.SelectedValue) < 1) nBeforeCode = 0;
 
                 cmbConstructionPerson.DataSource = null;
                 cmbConstructionPerson.Items.Clear();
@@ -957,9 +1180,10 @@
                 PersonRec.DepartmentCode = CommonMotions.cnvInt(objRec[2]);     // •”��ƒR�[ƒh
 
                 // “¯‚¶•”��‚Ì�ê�‡‚Í�ˆ—�‚µ‚È‚¢
-                if (DepartmentCode == PersonRec.DepartmentCode) return true;
+                //if (DepartmentCode == PersonRec.DepartmentCode) return true;
 
                 // •”��ƒRƒ“ƒ{ƒ{ƒbƒNƒX‚Ö•”��ƒR�[ƒhƒZƒbƒg
+                SetcmbDepartment();
                 cmbDepartment.SelectedValue = PersonRec.DepartmentCode;
                 SetcmbPersons();    // ’S“–ŽÒƒRƒ“ƒ{ƒ{ƒbƒNƒX•Ï�X
                 cmbConstructionPerson.SelectedValue = PersonCode;
@@ -1099,6 +1323,7 @@
                     switch (i)
                     {
                         case 0:
+                            // ƒf�[ƒ^‚æ‚è•”��Œo”ï‚ð’T‚·
                             strSQL.Append("Select");
                             strSQL.Append(" C.*");
                             strSQL.Append(" From");
@@ -1115,6 +1340,7 @@
                             strSQL.Append(" Order by C.DepartmentCode, C.DisplayOrder");
                             break;
                         case 1:
+                            // –³‚¢�ê�‡‚É•”��Œ{•àƒ}ƒXƒ^‚ð’¼�Ú“Ç‚Þ
                             strSQL.Append("Select");
                             strSQL.Append(" B.*");
                             strSQL.Append(" From divisionmaster AS A");
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Proceedings/FrmProceedingsAuxiliary.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Proceedings/FrmProceedingsAuxiliary.cs	(revision 343)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Proceedings/FrmProceedingsAuxiliary.cs	(revision 344)
@@ -1052,6 +1052,7 @@
             {
                 cmbConstructionPerson.SelectedIndexChanged -= new EventHandler(this.cmbConstructionPerson_SelectedIndexChanged);
                 int nBeforeCode = CommonMotions.cnvInt(cmbConstructionPerson.SelectedValue);
+                if (CommonMotions.cnvInt(cmbDepartment.SelectedValue) < 1) nBeforeCode = 0;
 
                 cmbConstructionPerson.DataSource = null;
                 cmbConstructionPerson.Items.Clear();
@@ -1131,9 +1132,10 @@
                 PersonRec.DepartmentCode = CommonMotions.cnvInt(objRec[2]);     // éƒ¨ç½²ã‚³ãƒ¼ãƒ‰
 
                 // å�Œã�˜éƒ¨ç½²ã�®å ´å�ˆã�¯å‡¦ç�†ã�—ã�ªã�„
-                if (DepartmentCode == PersonRec.DepartmentCode) return true;
+                //if (DepartmentCode == PersonRec.DepartmentCode) return true;
 
                 // éƒ¨ç½²ã‚³ãƒ³ãƒœãƒœãƒƒã‚¯ã‚¹ã�¸éƒ¨ç½²ã‚³ãƒ¼ãƒ‰ã‚»ãƒƒãƒˆ
+                SetcmbDepartment();
                 cmbDepartment.SelectedValue = PersonRec.DepartmentCode;
                 SetcmbPersons();    // æ‹…å½“è€…ã‚³ãƒ³ãƒœãƒœãƒƒã‚¯ã‚¹å¤‰æ›´
                 cmbConstructionPerson.SelectedValue = PersonCode;
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/PurchaseOrderStatus/FrmPurchaseOrderStatusAuxiliary.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/PurchaseOrderStatus/FrmPurchaseOrderStatusAuxiliary.cs	(revision 343)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/PurchaseOrderStatus/FrmPurchaseOrderStatusAuxiliary.cs	(revision 344)
@@ -1068,6 +1068,7 @@
             {
                 cmbConstructionPerson.SelectedIndexChanged -= new EventHandler(cmbConstructionPerson_SelectedIndexChanged);
                 int nBeforeCode = CommonMotions.cnvInt(cmbConstructionPerson.SelectedValue);
+                if (CommonMotions.cnvInt(cmbDepartment.SelectedValue) < 1) nBeforeCode = 0;
 
                 cmbConstructionPerson.DataSource = null;
                 cmbConstructionPerson.Items.Clear();
@@ -1146,9 +1147,10 @@
                 PersonRec.DepartmentCode = CommonMotions.cnvInt(objRec[2]);     // •”��ƒR�[ƒh
 
                 // “¯‚¶•”��‚Ì�ê�‡‚Í�ˆ—�‚µ‚È‚¢
-                if (DepartmentCode == PersonRec.DepartmentCode) return true;
+                //if (DepartmentCode == PersonRec.DepartmentCode) return true;
 
                 // •”��ƒRƒ“ƒ{ƒ{ƒbƒNƒX‚Ö•”��ƒR�[ƒhƒZƒbƒg
+                SetcmbDepartment();
                 cmbDepartment.SelectedValue = PersonRec.DepartmentCode;
                 SetcmbPersons();    // ’S“–ŽÒƒRƒ“ƒ{ƒ{ƒbƒNƒX•Ï�X
                 cmbConstructionPerson.SelectedValue = PersonCode;
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ReqbillingStatus/FrmReqBillingStatusAuxiliary.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ReqbillingStatus/FrmReqBillingStatusAuxiliary.cs	(revision 343)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ReqbillingStatus/FrmReqBillingStatusAuxiliary.cs	(revision 344)
@@ -1026,6 +1026,7 @@
             {
                 cmbConstructionPerson.SelectedIndexChanged -= new EventHandler(cmbConstructionPerson_SelectedIndexChanged);
                 int nBeforeCode = CommonMotions.cnvInt(cmbConstructionPerson.SelectedValue);
+                if (CommonMotions.cnvInt(cmbDepartment.SelectedValue) < 1) nBeforeCode = 0;
 
                 cmbConstructionPerson.DataSource = null;
                 cmbConstructionPerson.Items.Clear();
@@ -1105,9 +1106,10 @@
                 PersonRec.DepartmentCode = CommonMotions.cnvInt(objRec[2]);     // •”��ƒR�[ƒh
 
                 // “¯‚¶•”��‚Ì�ê�‡‚Í�ˆ—�‚µ‚È‚¢
-                if (DepartmentCode == PersonRec.DepartmentCode) return true;
+                //if (DepartmentCode == PersonRec.DepartmentCode) return true;
 
                 // •”��ƒRƒ“ƒ{ƒ{ƒbƒNƒX‚Ö•”��ƒR�[ƒhƒZƒbƒg
+                SetcmbDepartment();
                 cmbDepartment.SelectedValue = PersonRec.DepartmentCode;
                 SetcmbPersons();    // ’S“–ŽÒƒRƒ“ƒ{ƒ{ƒbƒNƒX•Ï�X
                 cmbConstructionPerson.SelectedValue = PersonCode;
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Request/RequestInputList/FrmReqInputListAuxiliary.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Request/RequestInputList/FrmReqInputListAuxiliary.cs	(revision 343)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Request/RequestInputList/FrmReqInputListAuxiliary.cs	(revision 344)
@@ -920,6 +920,7 @@
             {
                 cmbConstructionPerson.SelectedIndexChanged -= new EventHandler(cmbConstructionPerson_SelectedIndexChanged);
                 int nBeforeCode = CommonMotions.cnvInt(cmbConstructionPerson.SelectedValue);
+                if (CommonMotions.cnvInt(cmbDepartment.SelectedValue) < 1) nBeforeCode = 0;
 
                 cmbConstructionPerson.DataSource = null;
                 cmbConstructionPerson.Items.Clear();
@@ -998,9 +999,10 @@
                 PersonRec.DepartmentCode = CommonMotions.cnvInt(objRec[2]);     // •”��ƒR�[ƒh
 
                 // “¯‚¶•”��‚Ì�ê�‡‚Í�ˆ—�‚µ‚È‚¢
-                if (DepartmentCode == PersonRec.DepartmentCode) return true;
+                //if (DepartmentCode == PersonRec.DepartmentCode) return true;
 
                 // •”��ƒRƒ“ƒ{ƒ{ƒbƒNƒX‚Ö•”��ƒR�[ƒhƒZƒbƒg
+                SetcmbDepartment();
                 cmbDepartment.SelectedValue = PersonRec.DepartmentCode;
                 SetcmbPersons();    // ’S“–ŽÒƒRƒ“ƒ{ƒ{ƒbƒNƒX•Ï�X
                 cmbConstructionPerson.SelectedValue = PersonCode;
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Request/RequestSummaryList/FrmRequestSummaryListAuxiliary.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Request/RequestSummaryList/FrmRequestSummaryListAuxiliary.cs	(revision 343)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Request/RequestSummaryList/FrmRequestSummaryListAuxiliary.cs	(revision 344)
@@ -388,6 +388,7 @@
             {
                 cmbPerson.SelectedIndexChanged -= new EventHandler(cmbPerson_SelectedIndexChanged);
                 int nBeforeCode = CommonMotions.cnvInt(cmbPerson.SelectedValue);
+                if (CommonMotions.cnvInt(cmbDepartment.SelectedValue) < 1) nBeforeCode = 0;
 
                 cmbPerson.DataSource = null;
                 cmbPerson.Items.Clear();
@@ -504,9 +505,10 @@
                 PersonRec.DepartmentCode = CommonMotions.cnvInt(objRec[2]);     // •”��ƒR�[ƒh
 
                 // “¯‚¶•”��‚Ì�ê�‡‚Í�ˆ—�‚µ‚È‚¢
-                if (DepartmentCode == PersonRec.DepartmentCode) return true;
+                //if (DepartmentCode == PersonRec.DepartmentCode) return true;
 
                 // •”��ƒRƒ“ƒ{ƒ{ƒbƒNƒX‚Ö•”��ƒR�[ƒhƒZƒbƒg
+                SetcmbDepartment();
                 cmbDepartment.SelectedValue = PersonRec.DepartmentCode;
                 SetcmbPersons();    // ’S“–ŽÒƒRƒ“ƒ{ƒ{ƒbƒNƒX•Ï�X
                 cmbPerson.SelectedValue = PersonCode;
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/SubConstrRegist/FrmSubConstrRegistListAuxiliary.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/SubConstrRegist/FrmSubConstrRegistListAuxiliary.cs	(revision 343)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/SubConstrRegist/FrmSubConstrRegistListAuxiliary.cs	(revision 344)
@@ -749,6 +749,7 @@
             {
                 cmbConstructionPerson.SelectedIndexChanged -= new EventHandler(cmbConstructionPerson_SelectedIndexChanged);
                 int nBeforeCode = CommonMotions.cnvInt(cmbConstructionPerson.SelectedValue);
+                if (CommonMotions.cnvInt(cmbDepartment.SelectedValue) < 1) nBeforeCode = 0;
 
                 cmbConstructionPerson.DataSource = null;
                 cmbConstructionPerson.Items.Clear();
@@ -828,9 +829,10 @@
                 PersonRec.DepartmentCode = CommonMotions.cnvInt(objRec[2]);     // •”��ƒR�[ƒh
 
                 // “¯‚¶•”��‚Ì�ê�‡‚Í�ˆ—�‚µ‚È‚¢
-                if (DepartmentCode == PersonRec.DepartmentCode) return true;
+                //if (DepartmentCode == PersonRec.DepartmentCode) return true;
 
                 // •”��ƒRƒ“ƒ{ƒ{ƒbƒNƒX‚Ö•”��ƒR�[ƒhƒZƒbƒg
+                SetcmbDepartment();
                 cmbDepartment.SelectedValue = PersonRec.DepartmentCode;
                 SetcmbPersons();    // ’S“–ŽÒƒRƒ“ƒ{ƒ{ƒbƒNƒX•Ï�X
                 cmbConstructionPerson.SelectedValue = PersonCode;
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/TAndPCosts/FrmTAndPCostsAuxiliary.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/TAndPCosts/FrmTAndPCostsAuxiliary.cs	(revision 343)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/TAndPCosts/FrmTAndPCostsAuxiliary.cs	(revision 344)
@@ -420,6 +420,7 @@
             {
                 cmbConstructionPerson.SelectedIndexChanged -= new EventHandler(cmbConstructionPerson_SelectedIndexChanged);
                 int nBeforeCode = CommonMotions.cnvInt(cmbConstructionPerson.SelectedValue);
+                if (CommonMotions.cnvInt(cmbDepartment.SelectedValue) < 1) nBeforeCode = 0;
 
                 cmbConstructionPerson.DataSource = null;
                 cmbConstructionPerson.Items.Clear();
@@ -499,9 +500,10 @@
                 PersonRec.DepartmentCode = CommonMotions.cnvInt(objRec[2]);     // éƒ¨ç½²ã‚³ãƒ¼ãƒ‰
 
                 // å�Œã�˜éƒ¨ç½²ã�®å ´å�ˆã�¯å‡¦ç�†ã�—ã�ªã�„
-                if (DepartmentCode == PersonRec.DepartmentCode) return true;
+                //if (DepartmentCode == PersonRec.DepartmentCode) return true;
 
                 // éƒ¨ç½²ã‚³ãƒ³ãƒœãƒœãƒƒã‚¯ã‚¹ã�¸éƒ¨ç½²ã‚³ãƒ¼ãƒ‰ã‚»ãƒƒãƒˆ
+                SetcmbDepartment();
                 cmbDepartment.SelectedValue = PersonRec.DepartmentCode;
                 SetcmbPersons();    // æ‹…å½“è€…ã‚³ãƒ³ãƒœãƒœãƒƒã‚¯ã‚¹å¤‰æ›´
                 cmbConstructionPerson.SelectedValue = PersonCode;
Index: branches/src/ProcessManagement/ProcessManagement/Forms/ZMenu/FrmMenuAuxiliary.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/ZMenu/FrmMenuAuxiliary.cs	(revision 343)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/ZMenu/FrmMenuAuxiliary.cs	(revision 344)
@@ -6032,90 +6032,64 @@
             try
             {
                 int SelDepartment = CommonMotions.cnvInt(cmbDepartment.SelectedValue);
+                int NotOrder = CommonDefine.ProjectsStatus.First(x => x.Value.Equals("é�ž å�— æ³¨")).Key;
 
-                strSQL.Append("Select");
+                strSQL.Append("SELECT");
                 if (SelDepartment == 0)
                 {
-                    strSQL.Append(" Dep.DepartmentCode AS DepartmentCode");         // 0
-                    strSQL.Append(", Dep.DepartmentString AS DepName");             // 1
+                    strSQL.Append(" B.ConstrDepCode");                                          // 0
+                    strSQL.Append(", E.DetailString");                                          // 1
                 }
                 else
                 {
-                    strSQL.Append(" Person.PersonCode AS PersonCode");              // 0
-                    strSQL.Append(", Person.PersonName AS PerName");                // 1
+                    strSQL.Append(" C.PersonCode AS PersonCode");                               // 0
+                    strSQL.Append(", C.PersonName AS PerName");                                 // 1
                 }
-                strSQL.Append(", ReqDetail.Amount As Amount");                      // 2
-                strSQL.Append(", SUM(Ledger.CompanyExpenses) As CompExp");          // 3
-                strSQL.Append(", SUM(Ledger.DepartmentExpenses) As DepExp");        // 4
-                strSQL.Append(", SUM(Ledger.SalesExpenses) As SalesExp");           // 5
-                strSQL.Append(", SUM(Ledger.TOTALPAYMENT)");                        // 6
-                strSQL.Append(", SUM(Ledger.GrossProfit) As Gross");                // 7
-                strSQL.Append(", SUM(Ledger.NetProfit) As Net");                    // 8
-                strSQL.Append(", DATE_FORMAT(MAX(ReqDetail.UPDATEDATE), '%Y/%m/%d') AS ReqDate");   // 9
-                strSQL.Append(", DATE_FORMAT(MAX(Ledger.UPDATEDATE), '%Y/%m/%d') AS LedgerDate");   // 10
-                strSQL.Append(", SUM(Ledger.OrdersDecisionPrice) As OrderVal");     // 11
-
-                strSQL.Append(" From");
-                strSQL.Append(" personinchargemaster AS Person");
-                strSQL.AppendFormat(" LEFT JOIN {0} AS Dep ON Dep.DepartmentCode = Person.DepartmentCode"
-                                        , CreateGraphDepSQL((int)SalseGraphNum.Value));
-                strSQL.Append(" LEFT JOIN constructionbaseinfo AS Constr ON Constr.ConstructionPersonCode = Person.PersonCode");
-                strSQL.Append(" LEFT JOIN constructionledger As Ledger ON Ledger.ConstructionCode = Constr.ConstructionCode");
-
-                int NotOrder = CommonDefine.ProjectsStatus.First(x => x.Value.Equals("é�ž å�— æ³¨")).Key;
-                StringBuilder strSubSQL = new StringBuilder();
-                strSubSQL.Append(", (Select");
+                strSQL.Append(", SUM(G.REQUESTAMOUNT) As Amount");                              // 2
+                strSQL.Append(", SUM(A.COMPANYEXPENSES)");                                      // 3
+                strSQL.Append(", SUM(A.DEPARTMENTEXPENSES)");                                   // 4
+                strSQL.Append(", SUM(A.SALESEXPENSES)");                                        // 5
+                strSQL.Append(", SUM(A.TOTALPAYMENT)");                                         // 6
+                strSQL.Append(", SUM(A.GROSSPROFIT)");                                          // 7
+                strSQL.Append(", SUM(A.NETPROFIT)");                                            // 8
+                strSQL.Append(", DATE_FORMAT(MAX(G.UPDATEDATE), '%Y/%m/%d') AS ReqDate");       // 9
+                strSQL.Append(", DATE_FORMAT(MAX(A.UPDATEDATE), '%Y/%m/%d') AS LedgerDate");    // 10
+                strSQL.Append(", SUM(A.ORDERSDECISIONPRICE)");                                  // 11
+                strSQL.Append(" FROM");
+                strSQL.Append(" PERSONINCHARGEMASTER AS C");
+                strSQL.Append(" LEFT JOIN CONSTRUCTIONBASEINFO AS B");
+                strSQL.Append("       ON B.CONSTRUCTIONPERSONCODE = C.PERSONCODE");
+                strSQL.AppendFormat(" AND B.CONSTRUCTIONPERIOD = {0}", SalseGraphNum.Value);
+                strSQL.AppendFormat(" AND B.CONSTRUCTIONSTATUSFLG <> {0}", NotOrder);
+                strSQL.AppendFormat(" AND B.TyingFlg != {0}", (int)ConstructionBaseInfo.TyingFlgDef.Tying);
+                strSQL.Append(" LEFT JOIN constructionbaseinfodetail AS E");
+                strSQL.Append("       On E.ConstructionCode = B.ConstructionCode");
+                strSQL.AppendFormat(" And E.DetailNo = {0}", (int)ConstructionBaseInfoDetail.DataNoDef.ConstrDepartmentName);
+                strSQL.Append(" LEFT JOIN CONSTRUCTIONLEDGER AS A");
+                strSQL.Append("       ON A.CONSTRUCTIONCODE = B.CONSTRUCTIONCODE");
+                strSQL.Append(" LEFT JOIN(");
+                strSQL.Append("       Select");
+                strSQL.Append("         G1.MAINCONSTRUCTIONCODE");
+                strSQL.Append("       , SUM(G1.REQUESTAMOUNT) AS REQUESTAMOUNT");
+                strSQL.Append("       , G1.UPDATEDATE");
+                strSQL.Append("       From requestdatadetail As G1");
+                strSQL.Append("           Group By G1.MAINCONSTRUCTIONCODE) AS G");
+                strSQL.Append("       ON G.MAINCONSTRUCTIONCODE = B.ConstructionCode");
+                strSQL.Append(", DEPARTMENTMASTER D");
+                strSQL.Append(" WHERE");
+                strSQL.Append("  D.DEPARTMENTCODE = B.ConstrDepCode");
+                if (SelDepartment != 0) strSQL.AppendFormat(" AND B.ConstrDepCode = {0}", SelDepartment);
+                strSQL.Append(" GROUP BY");
                 if (SelDepartment == 0)
                 {
-                    strSubSQL.Append(" F.DepartmentCode AS DepartmentCode");
-                    strSubSQL.Append(", F.DepartmentString AS DepName");
+                    strSQL.Append("  B.ConstrDepCode, D.DISPLAYORDER");
+                    strSQL.Append(" ORDER BY D.DISPLAYORDER ASC");
                 }
                 else
                 {
-                    strSubSQL.Append(" A.PersonCode AS PersonCode");
-                    strSubSQL.Append(", A.PersonName AS PerName");
+                    strSQL.Append("  C.PersonCode, D.DISPLAYORDER");
+                    strSQL.Append(" ORDER BY C.DISPLAYORDER ASC");
                 }
-                strSubSQL.Append(", Sum(C.REQUESTAMOUNT) As Amount");
-                strSubSQL.Append(", DATE_FORMAT(MAX(C.UPDATEDATE), '%Y/%m/%d') AS UPDATEDATE");
-                strSubSQL.Append(" From");
-                strSubSQL.Append(" personinchargemaster AS A");
-                strSubSQL.Append(" LEFT JOIN constructionbaseinfo AS B ON B.ConstructionPersonCode = A.PersonCode");
-                strSubSQL.Append(" LEFT JOIN requestdatadetail AS C ON C.MAINCONSTRUCTIONCODE = B.ConstructionCode");
-                strSubSQL.Append(", constructionledger As D");
-                strSubSQL.Append(", departmentmaster AS F");
-                strSubSQL.Append(" WHERE");
-                strSubSQL.AppendFormat(" B.CONSTRUCTIONPERIOD = {0}", SalseGraphNum.Value);
-                strSubSQL.AppendFormat(" And B.CONSTRUCTIONSTATUSFLG <> {0}", NotOrder);
-                strSubSQL.Append(" And D.ConstructionCode = B.ConstructionCode");
-                strSubSQL.Append(" And F.DepartmentCode = A.DepartmentCode");
-                if (SelDepartment == 0)
-                {
-                    strSubSQL.Append(" Group By F.DepartmentCode");
-                }
-                else
-                {
-                    strSubSQL.AppendFormat(" And A.DepartmentCode = {0}", SelDepartment);
-                    strSubSQL.Append(" Group By A.PersonCode");
-                }
-                strSubSQL.AppendFormat(") AS ReqDetail");
-
-                strSQL.Append(strSubSQL.ToString());
-
-                strSQL.AppendFormat(" WHERE Constr.ConstructionPeriod = {0}", SalseGraphNum.Value);
-                strSQL.AppendFormat(" And Person.LEDGERFLG = {0}", (int)PersonInChargeMaster.LedgerDivNoDef.CalcTarget);
-
-                if (SelDepartment == 0)
-                {
-                    strSQL.Append(" And ReqDetail.DepartmentCode = Dep.DepartmentCode");
-                    strSQL.Append(" Group By Dep.DepartmentCode");
-                    strSQL.Append(" Order By Dep.DisplayOrder");
-                }
-                else
-                {
-                    strSQL.Append(" And ReqDetail.PersonCode = Person.PersonCode");
-                    strSQL.Append(" Group By Person.PersonCode");
-                    strSQL.Append(" Order By Person.EmployeeClassFlg, Person.DisplayOrder");
-                }
             }
             catch (Exception ex)
             {
@@ -6133,55 +6107,40 @@
             try
             {
                 StringBuilder strSQL = new StringBuilder();
+                int SelDepartment = CommonMotions.cnvInt(cmbDepartment.SelectedValue);
 
                 strSQL.Append("(Select");
-                strSQL.Append(" A1.SalesDepCode As DEPARTMENTCODE");
-                strSQL.Append(", B1.DetailString As DEPARTMENTSTRING");
-                strSQL.Append(", ifnull(C1.DisplayOrder, 10) As DISPLAYORDER");
-                strSQL.Append(" From Constructionbaseinfo As A1");
-                strSQL.Append("  Inner Join constructionbaseinfodetail As B1");
-                strSQL.Append("        On B1.ConstructionCode = A1.ConstructionCode");
-                strSQL.AppendFormat("  And B1.DetailNo = {0}", (int)ConstructionBaseInfoDetail.DataNoDef.SalesDepartmentName);
-                strSQL.Append("  Left Join departmentmaster As C1");
-                strSQL.Append("       On C1.DepartmentCode = A1.SalesDepCode");
-                strSQL.AppendFormat(" Where A1.ConstructionPeriod = {0}", nTargetCount);
+                if (SelDepartment == 0)
+                {
+                    strSQL.Append(" A2.ConstrDepCode As DEPARTMENTCODE");
+                    strSQL.Append(", B2.DetailString As DEPARTMENTSTRING");
+                    strSQL.Append(", ifnull(C2.DisplayOrder, 20) As DISPLAYORDER");
+                }
+                else
+                {
+                    strSQL.Append(", A2.ConstructionPersonCode");
+                    strSQL.Append(", D2.PersonName");
+                    strSQL.Append(", D2.EmployeeClassFlg");
+                    strSQL.Append(", ifnull(D2.DisplayOrder, 20) As DISPLAYORDER");
+                }
+                strSQL.Append(", A2.ConstructionCode");
+                strSQL.Append(" From Constructionbaseinfo As A2");
 
-                strSQL.Append(" Union Select");
-                strSQL.Append(" A2.ConstrDepCode As DEPARTMENTCODE");
-                strSQL.Append(", B2.DetailString As DEPARTMENTSTRING");
-                strSQL.Append(", ifnull(C2.DisplayOrder, 10) As DISPLAYORDER");
-                strSQL.Append(" From Constructionbaseinfo As A2");
                 strSQL.Append(" Inner Join constructionbaseinfodetail As B2");
-                strSQL.Append("       On B2.ConstructionCode = A2.ConstructionCode");
-                strSQL.AppendFormat(" And B2.DetailNo = {0}", (int)ConstructionBaseInfoDetail.DataNoDef.ConstrDepartmentName);
+                strSQL.Append("        On B2.ConstructionCode = A2.ConstructionCode");
+                strSQL.AppendFormat("  And B2.DetailNo = {0}", (int)ConstructionBaseInfoDetail.DataNoDef.ConstrDepartmentName);
+
+                strSQL.Append(" Inner Join personinchargemaster As D2");
+                strSQL.Append("       On D2.PersonCode = A2.ConstructionPersonCode");
+                strSQL.AppendFormat(" And D2.LEDGERFLG = {0}", (int)PersonInChargeMaster.LedgerDivNoDef.CalcTarget);
+
                 strSQL.Append(" Left Join departmentmaster As C2");
-                strSQL.Append("      On C2.DepartmentCode = A2.ConstrDepCode");
+                strSQL.Append("       On C2.DepartmentCode = A2.ConstrDepCode");
                 strSQL.AppendFormat(" Where A2.ConstructionPeriod = {0}", nTargetCount);
 
-                strSQL.Append(" Union Select");
-                strSQL.Append(" A3.ConstrSubDepCode As DEPARTMENTCODE");
-                strSQL.Append(", B3.DetailString As DEPARTMENTSTRING");
-                strSQL.Append(", ifnull(C3.DisplayOrder, 10) As DISPLAYORDER");
-                strSQL.Append(" From Constructionbaseinfo As A3");
-                strSQL.Append(" Inner Join constructionbaseinfodetail As B3");
-                strSQL.Append("       On B3.ConstructionCode = A3.ConstructionCode");
-                strSQL.AppendFormat(" And B3.DetailNo = {0}", (int)ConstructionBaseInfoDetail.DataNoDef.ConstrSubDepartmentName);
-                strSQL.Append(" Left Join departmentmaster As C3");
-                strSQL.Append("      On C3.DepartmentCode = A3.ConstrSubDepCode");
-                strSQL.AppendFormat(" Where A3.ConstructionPeriod = {0}", nTargetCount);
+                int NotOrder = CommonDefine.ProjectsStatus.First(x => x.Value.Equals("é�ž å�— æ³¨")).Key;
+                strSQL.AppendFormat(" And A2.ConstructionStatusFlg != {0})", NotOrder);
 
-                strSQL.Append(" Union Select");
-                strSQL.Append(" A4.ConstrInstrDepCode As DEPARTMENTCODE");
-                strSQL.Append(", B4.DetailString As DEPARTMENTSTRING");
-                strSQL.Append(", ifnull(C4.DisplayOrder, 10) As DISPLAYORDER");
-                strSQL.Append(" From Constructionbaseinfo As A4");
-                strSQL.Append(" Inner Join constructionbaseinfodetail As B4");
-                strSQL.Append("       On B4.ConstructionCode = A4.ConstructionCode");
-                strSQL.AppendFormat(" And B4.DetailNo = {0}", (int)ConstructionBaseInfoDetail.DataNoDef.InstrDepartmentName);
-                strSQL.Append(" Left Join departmentmaster As C4");
-                strSQL.Append("      On C4.DepartmentCode = A4.ConstrInstrDepCode");
-                strSQL.AppendFormat(" Where A4.ConstructionPeriod = {0})", nTargetCount);
-
                 return strSQL.ToString();
             }
             catch (Exception ex)
@@ -6206,6 +6165,7 @@
             IORequestDataDetail ReqDB = new IORequestDataDetail();
             IOMPersonInCharge PersonDB = new IOMPersonInCharge();
             IOCostDataOfPerson CostDB = new IOCostDataOfPerson();
+            IOConstructionLedger LedgerDB = new IOConstructionLedger();
             try
             {
                 // åˆ—ã�®ä½œæˆ�
@@ -6239,9 +6199,6 @@
                 DateTime wrkUpdate = DateTime.MinValue;
                 int DepCode = 0;
                 int PerCode = 0;
-                long DepSalary = 0;
-                long PaySalary = 0;
-                long CostValue = 0;
 
                 // çµŒè²»é…�åˆ—
                 int ArrayCount = CostDataOfPerson.DataNoStrArrary.Length;
@@ -6249,9 +6206,10 @@
 
                 int ino = 1;
                 int SelDepartment = CommonMotions.cnvInt(cmbDepartment.SelectedValue);
+                int TargetYear = (int)SalseGraphNum.Value;
+                int[] PayCostValue = new int[2];
                 foreach (object[] wrkRec in ArList)
                 {
-                    Array.Clear(CostArray, 0, CostArray.Length);
                     if (SelDepartment == 0)
                     {
                         DepCode = CommonMotions.cnvInt(wrkRec[0]);
@@ -6263,14 +6221,39 @@
                         PerCode = CommonMotions.cnvInt(wrkRec[0]);
                     }
 
-                    // éƒ¨ç½²æ¯Žçµ¦ä¸Žï¼ˆæŒ¯åˆ†çµ¦ä¸Žï¼�çµŒé�Žçµ¦ä¸Žï¼‹å‰¯æ‹…å½“çµ¦ä¸Žï¼‹æŒ‡å°Žå“¡çµ¦ä¸Žï¼‰
-                    DepSalary = CalcDepartmentSalary(PersonDB, DepCode, PerCode, dtDefStart, dtDefComp);
-                    // æ”¯æ‰•äººä»¶è²»ï¼ˆä»–éƒ¨ç½²å‰¯æ‹…å½“çµ¦ä¸Žï¼‹ä»–éƒ¨ç½²æŒ‡å°Žå“¡çµ¦ä¸Žï¼‰
-                    PaySalary = CalcPaySalary(PersonDB, DepCode, PerCode);
-                    // çµŒè²»å�–å¾—
-                    CreateLedgerSQL.GetPersonExpensesCostValue(CostDB, DepCode, PerCode, dtDefStart, dtDefComp, ref CostArray);
-                    CostValue = CostArray.Sum();
+                    // ----- æ‹…å½“è€…æ¯Žã�®æŒ‡å®šæœŸã�®é–‹å§‹ãƒ»çµ‚äº†å¹´æœˆæ—¥ã‚’å�–å¾—ã�™ã‚‹
+                    ArrayList TargetList = new ArrayList();
+                    CommonLedgerData.GetPersonInDepartment(TargetYear, DepCode, PerCode, ref TargetList);
 
+                    // å¯¾è±¡ã�®çµŒé�Žçµ¦ä¸Žã‚’å�–å¾—ã�™ã‚‹
+                    List<SalaryClass> ArrarySalary = new List<SalaryClass>();
+                    CommonLedgerData.GetElapsedSalaryAll(PersonDB, TargetYear, ref TargetList, ref ArrarySalary);
+
+                    // çµ¦ä¸Žç´¯ç©�å�–å¾—
+                    long TotalSalary = ArrarySalary.Sum(y => y.SalaryValue);
+
+                    // å·¥äº‹ã�«å±žã�—ã�¦ã�„ã�ªã�„çµŒè²»ã‚’å�–å¾—ã�™ã‚‹
+                    List<PersonExpensesCost> ArraryCost = new List<PersonExpensesCost>();
+                    CommonLedgerData.GetPersonExpensesCostValueAll(CostDB, TargetYear, ArrarySalary, ref ArraryCost);
+                    int CostValue = 0;
+                    foreach (PersonExpensesCost CurRec in ArraryCost)
+                    {
+                        CostValue += CurRec.CostValue.Sum();
+                    }
+
+                    int OtherValue = 0;
+                    // ä»–éƒ¨ç½²ã�®å‰¯æ‹…å½“ãƒ»æŒ‡å°Žå“¡ã‚’å�–å¾—ã�™ã‚‹
+                    ArrayList OtherArrary = new ArrayList();
+                    // ä»–æŒ¯åˆ†é‡‘é¡�ã‚’å�–å¾—ã�™ã‚‹
+                    CommonLedgerData.GetPersonOuterCostValue(TargetYear, DepCode, ref OtherArrary);
+                    foreach (object[] objRec in OtherArrary)
+                    {
+                        int PlusMinus = CommonMotions.cnvInt(objRec[0]);
+                        int GrpNo = CommonMotions.cnvInt(objRec[1]);
+                        int Value = CommonMotions.cnvInt(objRec[2]);
+                        OtherValue += (Value * PlusMinus);
+                    }
+
                     // ãƒ‡ãƒ¼ã‚¿ã�®è¿½åŠ 
                     dtRow = ds.Tables[0].NewRow();
                     // éƒ¨ç½²å��
@@ -6278,7 +6261,8 @@
                     // å�—æ³¨é‡‘é¡�
                     dtRow[1] = CommonMotions.cnvLong(wrkRec[11]);
                     // è«‹æ±‚é‡‘é¡�
-                    dtRow[2] = CommonMotions.cnvLong(wrkRec[2]);
+                    long AllBilling = CommonMotions.cnvLong(wrkRec[2]);
+                    dtRow[2] = AllBilling;
                     // ä¼šç¤¾çµŒè²»
                     dtRow[3] = CommonMotions.cnvLong(wrkRec[3]);
                     // éƒ¨ç½²çµŒè²»
@@ -6285,10 +6269,13 @@
                     dtRow[4] = CommonMotions.cnvLong(wrkRec[4]);
                     // å–¶æ¥­ç®¡ç�†è²»
                     dtRow[5] = CommonMotions.cnvLong(wrkRec[5]);
+                    // ç·�æ”¯æ‰•é¡�
+                    long AllPayment = CommonMotions.cnvLong(wrkRec[6]);
                     // ç²—åˆ©ç›Šï¼ˆå£²ä¸Šï¼�ç·�æ”¯æ‰•é¡�ï¼�çµŒè²»ï¼‰
-                    dtRow[6] = CommonMotions.cnvLong(wrkRec[2]) - CommonMotions.cnvLong(wrkRec[6]) - CostValue;
-                    // ç´”åˆ©ç›Šï¼ˆå£²ä¸Šï¼�ç·�æ”¯æ‰•é¡�ï¼�çµŒè²»ï¼�æ”¯æ‰•äººä»¶è²»ï¼‹éƒ¨ç½²çµ¦ä¸Žå·®é¡�ï¼‰
-                    dtRow[7] = (CommonMotions.cnvLong(wrkRec[2]) - CommonMotions.cnvLong(wrkRec[6]) - CostValue) - PaySalary + DepSalary;
+                    dtRow[6] = AllBilling - AllPayment - CostValue;
+                    // ç´”åˆ©ç›Šï¼ˆå£²ä¸Šï¼�ç·�æ”¯æ‰•é¡�ï¼�çµŒè²»ï¼�æ”¯æ‰•äººä»¶è²»ï¼�ä»–éƒ¨ç½²å·®é¡�ï¼‰
+                    //dtRow[7] = (AllBilling - AllPayment - CostValue) + DepSalary;
+                    dtRow[7] = (AllBilling - AllPayment - CostValue) - TotalSalary + OtherValue;
                     ds.Tables[0].Rows.Add(dtRow);
 
                     // 1ç•ªå¤§ã��ã�„æ›´æ–°å€¤ã‚’å�–ã‚‹
@@ -6316,6 +6303,8 @@
                 ReqDB.close(); ReqDB = null;
                 PersonDB.close(); PersonDB = null;
                 CostDB.close(); CostDB = null;
+                LedgerDB.close(); LedgerDB = null;
+
                 DisplayControlProgressBar(false);
                 btnConstrSearch.Visible = false;
             }
@@ -6324,322 +6313,6 @@
         }
         #endregion
 
-        #region çµ¦ä¸Žé‡‘é¡�é…�åˆ—ä½�ç½®
-        /// <summary>
-        /// çµ¦ä¸Žé‡‘é¡�é…�åˆ—ä½�ç½®
-        /// </summary>
-        private enum SalVal
-        {
-            Payroll = 0,
-            Assistant,
-            Instructor,
-        }
-        #endregion
-        
-        #region æ”¯æ‰•äººä»¶è²»å�–å¾—
-        /// <summary>
-        /// æ”¯æ‰•äººä»¶è²»å�–å¾—
-        /// </summary>
-        /// <returns></returns>
-        private long CalcPaySalary(IOMPersonInCharge PersonDB, int DepartmentCode, int PersonCode)
-        {
-            try
-            {
-                StringBuilder strSQL = new StringBuilder();
-                // å�–å¾—ï¼³ï¼±ï¼¬ä½œæˆ�
-                strSQL.Append("Select");
-                strSQL.Append(" SUM(C.PaymentAmount)");
-                strSQL.Append(" From constructionbaseinfo AS A");
-                strSQL.Append(", constructionledgerdetail AS B");
-
-                strSQL.Append(" LEFT JOIN (Select");
-                strSQL.Append(" C2.ConstructionCode AS ConstructionCode");
-                strSQL.Append(", C2.GroupCount AS GroupCount");
-                strSQL.Append(", C2.LineCount AS LineCount");
-                strSQL.Append(", SUM(C2.PaymentAmount) AS PaymentAmount");
-                strSQL.Append(" From constructionledgerexcute C2");
-                strSQL.Append(" Group By C2.ConstructionCode, C2.GroupCount, C2.LineCount) AS C");
-                strSQL.Append(" ON C.ConstructionCode = B.ConstructionCode");
-                strSQL.Append(" And C.GroupCount = B.GroupCount");
-                strSQL.Append(" And C.LineCount = B.LineCount");
-                if (PersonCode == 0)
-                {
-                    strSQL.Append(" Where A.ConstructionPersonCode IN (");
-                    strSQL.Append(" SELECT APerson.PERSONCODE FROM personinchargemaster As APerson");
-                    strSQL.AppendFormat(" Where APerson.DepartmentCode = {0})", DepartmentCode);
-                }
-                else
-                {
-                    strSQL.AppendFormat(" Where A.ConstructionPersonCode = {0}", PersonCode);
-                }
-                strSQL.AppendFormat(" And A.ConstructionPeriod = {0}", SalseGraphNum.Value);
-                strSQL.Append(" And B.ConstructionCode = A.ConstructionCode");
-                strSQL.AppendFormat(" And B.GroupCount IN ({0}, {1})"
-                                    , (int)FrmConstructionLedger.DataGroup.Instructor
-                                    , (int)FrmConstructionLedger.DataGroup.Assistant);
-
-                // éƒ¨å†…å¯¾è±¡å�–å¾—
-                ArrayList ArList = new ArrayList();
-                PersonDB.ExecuteReader(strSQL.ToString(), ref ArList);
-
-                long lRet = 0;
-                foreach (object[] objRec in ArList)
-                {
-                    lRet += CommonMotions.cnvLong(objRec[0]);
-                }
-
-                return lRet;
-            }
-            catch (Exception ex)
-            {
-                logger.ErrorFormat("ã‚·ã‚¹ãƒ†ãƒ ã‚¨ãƒ©ãƒ¼ï¼š{0}ï¼š{1}", CommonMotions.GetMethodName(), ex.Message);
-                return 0;
-            }
-        }
-        #endregion
-
-        #region éƒ¨ç½²æ¯Žç¯„å›²çµ¦ä¸Žå�–å¾—
-        /// <summary>
-        /// éƒ¨ç½²æ¯Žç¯„å›²çµ¦ä¸Žå�–å¾—
-        /// </summary>
-        /// <returns></returns>
-        private long CalcDepartmentSalary(IOMPersonInCharge PersonDB,
-                                            int DepartmentCode, int PersonCode,
-                                            DateTime dtDefStart, DateTime dtDefComp)
-        {
-            try
-            {
-                StringBuilder strSQL = new StringBuilder();
-                // å�–å¾—ï¼³ï¼±ï¼¬ä½œæˆ�
-                CreateDepSalarySQL(DepartmentCode, PersonCode, ref strSQL, dtDefStart, dtDefComp);
-                // éƒ¨å†…å¯¾è±¡å�–å¾—
-                ArrayList ArList = new ArrayList();
-                PersonDB.ExecuteReader(strSQL.ToString(), ref ArList);
-
-                long lRet = 0;
-                int DepCode = 0;
-                int CurPersonCode = 0;
-                int TotalSalary = 0;
-                DateTime dtStart = DateTime.Today;
-                DateTime dtComp = DateTime.Today;
-                DateTime dtInTime = DateTime.Today;
-                DateTime dtOutTime = DateTime.Today;
-
-                int getCnt = Enum.GetNames(typeof(SalVal)).Length;
-                long[] SVal = new long[getCnt];
-                foreach (object[] objRec in ArList)
-                {
-                    DepCode = CommonMotions.cnvInt(objRec[0]);
-                    CurPersonCode = CommonMotions.cnvInt(objRec[1]);
-                    dtStart = CommonMotions.cnvDate(objRec[2]);
-                    dtComp = CommonMotions.cnvDate(objRec[3]);
-                    dtInTime = CommonMotions.cnvDate(objRec[4]);
-                    dtOutTime = CommonMotions.cnvDate(objRec[5]);
-
-                    // é–‹å§‹æ—¥ç„¡ã�¯æœŸé¦–
-                    if (dtStart.Date == DateTime.MinValue.Date) dtStart = dtDefStart;
-                    // å…¥ç¤¾æ—¥ã�Œè©²å½“ç¯„å›²å†…ã�ªã‚‰ã�°å¤‰æ›´
-                    if (dtDefStart <= dtInTime && dtInTime <= dtDefComp) dtStart = dtInTime;
-                    // é�¸æŠžæœŸã�Œä»ŠæœŸä»¥å‰�ã�¯æœŸæœ«ã�«å¤‰æ›´
-                    if (SalseGraphNum.Value < CommonMotions.GetPeriodYear()) dtComp = dtDefComp;
-                    // é€€ç¤¾æ—¥ã�Œè©²å½“ç¯„å›²å†…ã�ªã‚‰ã�°å¤‰æ›´
-                    if (dtDefStart <= dtOutTime && dtOutTime <= dtDefComp) dtComp = dtOutTime;
-
-                    // çµŒé�Žçµ¦ä¸Žå�–å¾—
-                    TotalSalary = CommonMotions.CalcElapsedSalary(PersonDB, dtStart, dtComp, CurPersonCode);
-                    // æŒ¯åˆ†ã�®å�–å¾—
-                    Array.Clear(SVal, 0, SVal.Length);
-                    GetSalaryValue(PersonDB, DepartmentCode, CurPersonCode, ref SVal);
-
-                    lRet += (TotalSalary * -1) + (SVal[(int)SalVal.Assistant] + SVal[(int)SalVal.Instructor]);
-                }
-
-
-                return lRet;
-            }
-            catch (Exception ex)
-            {
-                logger.ErrorFormat("ã‚·ã‚¹ãƒ†ãƒ ã‚¨ãƒ©ãƒ¼ï¼š{0}ï¼š{1}", CommonMotions.GetMethodName(), ex.Message);
-                return 0;
-            }
-        }
-        #endregion
-
-        #region éƒ¨ç½²æ¯Žçµ¦ä¸Žç¯„å›²å�–å¾—SQLä½œæˆ�
-        /// <summary>
-        /// éƒ¨ç½²æ¯Žçµ¦ä¸Žç¯„å›²å�–å¾—SQLä½œæˆ�
-        /// </summary>
-        /// <param name="strSQL"></param>
-        private void CreateDepSalarySQL(int DepartmentCode, int PersonCode, ref StringBuilder strSQL, DateTime dtDefStart, DateTime dtDefComp)
-        {
-            try
-            {
-                int NotOrder = CommonDefine.ProjectsStatus.First(x => x.Value.Equals("é�ž å�— æ³¨")).Key;
-                strSQL.Append("Select");
-                strSQL.Append(" Person.DepartmentCode");
-                strSQL.Append(", Person.PersonCode");
-                strSQL.Append(", Detail.SDate");
-                strSQL.Append(", Detail.EDate");
-                strSQL.Append(", Person.StartDate");
-                strSQL.Append(", Person.EndDate ");
-                strSQL.Append(" From");
-                strSQL.Append(" personinchargemaster As Person");
-                strSQL.Append(" Left Join (");
-                strSQL.Append(" Select");
-                strSQL.Append(" Ledger.PersonCode AS PersonCode");
-                strSQL.Append(", MIN(Ledger.Start0) As SDate");
-                strSQL.Append(", MAX(Ledger.Comp0) AS EDate");
-                strSQL.Append(" From");
-                strSQL.Append(" (Select");
-                strSQL.Append(" LDetail.CompanyCode As PersonCode");
-                strSQL.Append(", Ledger.ConstructionStart As Start0");
-                strSQL.Append(", Ledger.ConstructionEnd As Comp0");
-                strSQL.Append(", LDetail.GROUPCOUNT");
-                strSQL.Append(", LDetail.ConstructionCode");
-                strSQL.Append(" From");
-                strSQL.Append(" constructionledgerdetail As LDetail");
-                strSQL.Append(" Inner Join constructionledger As Ledger On Ledger.ConstructionCode = LDetail.ConstructionCode");
-                strSQL.Append(", constructionbaseinfo As Base");
-                strSQL.Append(" Where");
-                strSQL.AppendFormat(" LDetail.GroupCount IN ({0}, {1}, {2})"
-                                    , (int)FrmConstructionLedger.DataGroup.Instructor
-                                    , (int)FrmConstructionLedger.DataGroup.Assistant
-                                    , (int)FrmConstructionLedger.DataGroup.Payroll);
-                strSQL.Append(" And LDetail.CompanyCode <> 0");
-                strSQL.Append(" And Base.ConstructionCode = LDetail.ConstructionCode");
-                strSQL.AppendFormat(" And Base.ConstructionStatusFlg <> {0}", NotOrder);
-                strSQL.AppendFormat(" And Base.ConstructionPeriod = {0}", SalseGraphNum.Value);
-                strSQL.Append(" ) As Ledger");
-                strSQL.Append(" Group By Ledger.PersonCode");
-                strSQL.Append(") As Detail");
-                strSQL.Append(" ON Detail.PersonCode = Person.PersonCode");
-                strSQL.AppendFormat(" Where Person.DepartmentCode = {0}", DepartmentCode);
-                if (PersonCode > 0) strSQL.AppendFormat(" And Person.PersonCode = {0}", PersonCode);
-                strSQL.AppendFormat(" And Person.LEDGERFLG = {0}", (int)PersonInChargeMaster.LedgerDivNoDef.CalcTarget);
-                strSQL.AppendFormat(" And ((DATE (Person.StartDate) <= DATE ('{0}')", dtDefStart.ToShortDateString());
-                strSQL.AppendFormat(" And DATE (Person.EndDate) = DATE ('{0}'))", DateTime.MinValue.ToShortDateString());
-                strSQL.AppendFormat(" Or (DATE ('{0}') <= DATE (Person.StartDate)", dtDefStart.ToShortDateString());
-                strSQL.AppendFormat(" And DATE (Person.StartDate) <= DATE ('{0}'))", dtDefComp.ToShortDateString());
-                strSQL.AppendFormat(" Or (DATE ('{0}') <= DATE (Person.EndDate)", dtDefStart.ToShortDateString());
-                strSQL.AppendFormat(" And DATE (Person.EndDate) <= DATE ('{0}')))", dtDefComp.ToShortDateString());
-
-            }
-            catch (Exception ex)
-            {
-                logger.ErrorFormat("ã‚·ã‚¹ãƒ†ãƒ ã‚¨ãƒ©ãƒ¼ï¼š{0}ï¼š{1}", CommonMotions.GetMethodName(), ex.Message);
-            }
-        }
-        #endregion
-
-        #region æŒ¯åˆ†æ‰€å¾—å�–è¾¼
-        /// <summary>
-        /// æŒ¯åˆ†æ‰€å¾—å�–è¾¼
-        /// </summary>
-        private void GetSalaryValue(IOMPersonInCharge PersonDB, int DepartmentCode, int PersonCode, ref long[] lVal)
-        {
-            try
-            {
-                StringBuilder strSQL = new StringBuilder();
-                // å�–å¾—ï¼³ï¼±ï¼¬ä½œæˆ�
-                CreateSalaryValSQL(DepartmentCode, PersonCode, ref strSQL);
-                // éƒ¨å†…å¯¾è±¡å�–å¾—
-                ArrayList ArList = new ArrayList();
-                PersonDB.ExecuteReader(strSQL.ToString(), ref ArList);
-
-                foreach (object[] objRec in ArList)
-                {
-                    switch (CommonMotions.cnvInt(objRec[2]))
-                    {
-                        case (int)FrmConstructionLedger.DataGroup.Payroll:
-                            lVal[(int)SalVal.Payroll] += CommonMotions.cnvInt(objRec[3]);
-                            break;
-                        case (int)FrmConstructionLedger.DataGroup.Assistant:
-                            lVal[(int)SalVal.Assistant] += CommonMotions.cnvInt(objRec[3]);
-                            break;
-                        case (int)FrmConstructionLedger.DataGroup.Instructor:
-                            lVal[(int)SalVal.Instructor] += CommonMotions.cnvInt(objRec[3]);
-                            break;
-                    }
-                }
-            }
-            catch (Exception ex)
-            {
-                logger.ErrorFormat("ã‚·ã‚¹ãƒ†ãƒ ã‚¨ãƒ©ãƒ¼ï¼š{0}ï¼š{1}", CommonMotions.GetMethodName(), ex.Message);
-            }
-        }
-        #endregion
-
-        #region æŒ¯åˆ†æ‰€å¾—å�–è¾¼SQLä½œæˆ�
-        /// <summary>
-        /// æŒ¯åˆ†æ‰€å¾—å�–è¾¼SQLä½œæˆ�
-        /// </summary>
-        /// <param name="DepartmentCode"></param>
-        /// <param name="strSQL"></param>
-        private void CreateSalaryValSQL(int DepartmentCode, int PersonCode, ref StringBuilder strSQL)
-        {
-            try
-            {
-                int NotOrder = CommonDefine.ProjectsStatus.First(x => x.Value.Equals("é�ž å�— æ³¨")).Key;
-
-                strSQL.Append("Select");
-                strSQL.Append(" ifnull(Department.DepartmentCode, 0) As DepartmentCode");
-                strSQL.Append(", Person.PersonCode As PersonCode");
-                strSQL.Append(", SearchDate.GroupCnt As GroupCnt");
-                strSQL.Append(", SearchDate.Salary As Salary");
-                strSQL.Append(" From");
-                strSQL.Append(" personinchargemaster As Person");
-                strSQL.Append(" Left Join departmentmaster As Department ON Department.DepartmentCode = Person.DepartmentCode");
-                strSQL.Append(" LEFT JOIN (");
-                strSQL.Append(" Select tmpSalary.PersonCode As PersonCode");
-                strSQL.Append(", tmpSalary.GroupCnt As GroupCnt");
-                strSQL.Append(", SUM(tmpSalary.PaymentAmount) As Salary");
-                strSQL.Append(" From (SELECT");
-                strSQL.Append(" ifnull(C2.CompanyCode, 0) As PersonCode");
-                strSQL.Append(", C1.CONSTRUCTIONPERIOD As PERIOD");
-                strSQL.Append(", C2.GROUPCOUNT As GroupCnt");
-                strSQL.Append(", C4.PaymentAmount As PaymentAmount");
-                strSQL.Append(" FROM");
-                strSQL.Append(" CONSTRUCTIONBASEINFO C1");
-                strSQL.Append(", CONSTRUCTIONLEDGERDETAIL C2");
-                
-                strSQL.Append(" LEFT JOIN (Select");
-                strSQL.Append(" CC4.ConstructionCode AS ConstructionCode");
-                strSQL.Append(", CC4.GroupCount AS GroupCount");
-                strSQL.Append(", CC4.LineCount AS LineCount");
-                strSQL.Append(", SUM(CC4.PaymentAmount) AS PaymentAmount");
-                strSQL.Append(" From constructionledgerexcute CC4");
-                strSQL.Append(" Group By CC4.ConstructionCode, CC4.GroupCount, CC4.LineCount) AS C4");
-                strSQL.Append(" ON C4.ConstructionCode = C2.ConstructionCode");
-                strSQL.Append(" And C4.GroupCount = C2.GroupCount");
-                strSQL.Append(" And C4.LineCount = C2.LineCount");
-
-                strSQL.Append(", personinchargemaster As Person");
-                strSQL.Append(" WHERE");
-                strSQL.AppendFormat(" C1.CONSTRUCTIONSTATUSFLG <> {0}", NotOrder);
-                strSQL.AppendFormat(" And C1.CONSTRUCTIONPERIOD = {0}", SalseGraphNum.Value);
-                strSQL.Append(" And C2.CONSTRUCTIONCODE = C1.CONSTRUCTIONCODE");
-                strSQL.AppendFormat(" AND C2.GROUPCOUNT In ({0}, {1}, {2})"
-                                        , (int)FrmConstructionLedger.DataGroup.Instructor
-                                        , (int)FrmConstructionLedger.DataGroup.Assistant
-                                        , (int)FrmConstructionLedger.DataGroup.Payroll);
-                strSQL.Append(" And Person.PersonCode = C2.CompanyCode");
-                strSQL.AppendFormat(" And Person.DepartmentCode = {0}", DepartmentCode);
-                if (PersonCode > 0) strSQL.AppendFormat(" And Person.PersonCode = {0}", PersonCode);
-                strSQL.Append(" ) as tmpSalary");
-                strSQL.Append(" Group By PersonCode, GroupCnt) AS SearchDate ON SearchDate.PersonCode = Person.PersonCode");
-                strSQL.AppendFormat(" Where Department.DepartmentCode = {0}", DepartmentCode);
-                strSQL.Append(" Group By SearchDate.PersonCode, SearchDate.GroupCnt");
-                strSQL.Append(" Having DepartmentCode != 0");
-                strSQL.Append(" Order By  PersonCode, GroupCnt");
-
-            }
-            catch (Exception ex)
-            {
-                logger.ErrorFormat("ã‚·ã‚¹ãƒ†ãƒ ã‚¨ãƒ©ãƒ¼ï¼š{0}ï¼š{1}", CommonMotions.GetMethodName(), ex.Message);
-            }
-        }
-        #endregion
-
         #region æœŸã�®æœ€å¤§ãƒ»æœ€å°‘ã‚’ã‚»ãƒƒãƒˆã�™ã‚‹ï¼ˆå£²ä¸Šã‚°ãƒ©ãƒ•ï¼‰
         /// <summary>
         /// æœŸã�®æœ€å¤§ãƒ»æœ€å°‘ã‚’ã‚»ãƒƒãƒˆã�™ã‚‹ï¼ˆå£²ä¸Šã‚°ãƒ©ãƒ•ï¼‰
@@ -6648,6 +6321,8 @@
         {
             try
             {
+                SalseGraphNum.ValueChanged -= new EventHandler(SalseGraphNum_ValueChanged);
+
                 // ãƒ‡ãƒ¼ã‚¿ã�«ã�‚ã‚‹äº‹æ¥­æœŸã�¨ç�¾åœ¨ã�®äº‹æ¥­ã‚»ãƒƒãƒˆ
                 int minval = 0;
                 int maxval = 0;
@@ -6660,6 +6335,10 @@
             {
                 logger.ErrorFormat("ã‚·ã‚¹ãƒ†ãƒ ã‚¨ãƒ©ãƒ¼ï¼š{0}ï¼š{1}", CommonMotions.GetMethodName(), ex.Message);
             }
+            finally
+            {
+                SalseGraphNum.ValueChanged += new EventHandler(SalseGraphNum_ValueChanged);
+            }
         }
         #endregion
         #endregion
Index: branches/src/ProcessManagement/ProcessManagement/ProcessManagement.csproj
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/ProcessManagement.csproj	(revision 343)
+++ branches/src/ProcessManagement/ProcessManagement/ProcessManagement.csproj	(revision 344)
@@ -307,7 +307,7 @@
     <Compile Include="Forms\DataEntry\ConstructionJoin\FrmJoinSelect.designer.cs">
       <DependentUpon>FrmJoinSelect.cs</DependentUpon>
     </Compile>
-    <Compile Include="Forms\DataEntry\ConstructionLedgerList\CreateLedgerSQL.cs" />
+    <Compile Include="Forms\DataEntry\ConstructionLedgerList\CommonLedgerData.cs" />
     <Compile Include="Forms\DataEntry\ConstructionLedgerList\ProcessControl.cs">
       <SubType>Form</SubType>
     </Compile>
@@ -1777,9 +1777,6 @@
     <EmbeddedResource Include="Forms\SubForms\Material\FrmMaterialSelect.resx">
       <DependentUpon>FrmMaterialSelect.cs</DependentUpon>
     </EmbeddedResource>
-    <EmbeddedResource Include="Forms\TestForm\Form1.resx">
-      <DependentUpon>Form1.cs</DependentUpon>
-    </EmbeddedResource>
     <EmbeddedResource Include="Forms\ZMenu\FrmChangePassword.resx">
       <DependentUpon>FrmChangePassword.cs</DependentUpon>
     </EmbeddedResource>
Index: branches/src/ProcessManagement/ProcessManagement/Properties/AssemblyInfo.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Properties/AssemblyInfo.cs	(revision 343)
+++ branches/src/ProcessManagement/ProcessManagement/Properties/AssemblyInfo.cs	(revision 344)
@@ -32,7 +32,7 @@
 // ã�™ã�¹ã�¦ã�®å€¤ã‚’æŒ‡å®šã�™ã‚‹ã�‹ã€�ä¸‹ã�®ã‚ˆã�†ã�« '*' ã‚’ä½¿ã�£ã�¦ãƒ“ãƒ«ãƒ‰ã�Šã‚ˆã�³ãƒªãƒ“ã‚¸ãƒ§ãƒ³ç•ªå�·ã‚’ 
 // æ—¢å®šå€¤ã�«ã�™ã‚‹ã�“ã�¨ã�Œã�§ã��ã�¾ã�™:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.1.181")]
-[assembly: AssemblyFileVersion("1.0.1.181")]
+[assembly: AssemblyVersion("1.0.1.192")]
+[assembly: AssemblyFileVersion("1.0.1.192")]
 // Log4netã‚’ä½¿ç”¨ã�™ã‚‹
 [assembly: log4net.Config.XmlConfigurator(ConfigFile = @"log4net.config", Watch = true)]
\ No newline at end of file
