Index: branches/src/ProcessManagement/ProcessManagement/Common/CommonDefine.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Common/CommonDefine.cs	(revision 260)
+++ branches/src/ProcessManagement/ProcessManagement/Common/CommonDefine.cs	(revision 261)
@@ -389,35 +389,6 @@
         }
         #endregion
 
-        #region åŒºåˆ†ãƒžã‚¹ã‚¿ï¼šãƒ‡ãƒ¼ã‚¿åˆ†ã�‘åŒºåˆ†
-        /// <summary>
-        /// åŒºåˆ†ãƒžã‚¹ã‚¿åŒºåˆ†
-        /// </summary>
-        public enum DivisionMasterCodeDefine
-        {
-            /// <summary>
-            /// ç™ºæ³¨è€…åŒºåˆ†ç™»éŒ²
-            /// </summary>
-            OrderDivision = 1,
-            /// <summary>
-            /// å·¥äº‹ç¨®åˆ¥ç™»éŒ²
-            /// </summary>
-            ConstructionClass = 2,
-            /// <summary>
-            /// å·¥äº‹çµŒè²»å��ç§°ç™»éŒ²
-            /// </summary>
-            ConstructionExpenses = 3,
-        }
-        /// <summary>
-        /// åŒºåˆ†ãƒžã‚¹ã‚¿åŒºåˆ†ã‚­ãƒ¼
-        /// </summary>
-        public static Dictionary<int, string> DivisionMasterCode = new Dictionary<int, string>(){
-                                                                                {1, "ç™ºæ³¨è€…åŒºåˆ†ç™»éŒ²"},
-                                                                                {2, "å·¥äº‹ç¨®åˆ¥ç™»éŒ²"},
-                                                                                {3, "å·¥äº‹çµŒè²»å��ç§°ç™»éŒ²"},
-                                                                                };
-        #endregion
-
         #region æœŸé™�ãƒžã‚¹ã‚¿ï¼šæ—¥ä»˜ãƒ�ã‚§ãƒƒã‚¯ã‚¿ã‚¤ãƒŸãƒ³ã‚°
         /// <summary>
         /// æœŸé™�ãƒžã‚¹ã‚¿ï¼šæ—¥ä»˜ãƒ�ã‚§ãƒƒã‚¯ã‚¿ã‚¤ãƒŸãƒ³ã‚°
Index: branches/src/ProcessManagement/ProcessManagement/Common/CommonMotions.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Common/CommonMotions.cs	(revision 260)
+++ branches/src/ProcessManagement/ProcessManagement/Common/CommonMotions.cs	(revision 261)
@@ -2253,8 +2253,6 @@
             try
             {
                 string strwork = string.Empty;
-                string strwork2 = string.Empty;
-                string strwork3 = string.Empty;
                 if (bPeriod)
                 {   // å–¶æ¥­æœŸ
                     strwork = CommonMotions.SystemMasterData.BusinessBeginningDate;
@@ -2263,10 +2261,9 @@
                 {   // å·¥äº‹å¹´åº¦
                     strwork = CommonMotions.SystemMasterData.ConstructionBeginningDate;
                 }
-                strwork2 = strwork.Substring(0, strwork.IndexOf("/"));
-                strwork3 = strwork.Substring(strwork.IndexOf("/") + 1, 2);
-                Mounth = CommonMotions.cnvInt(strwork2);
-                Days = CommonMotions.cnvInt(strwork3);
+                string[] strArray = strwork.Split('/');
+                Mounth = CommonMotions.cnvInt(strArray[0]);
+                Days = CommonMotions.cnvInt(strArray[1]);
 
             }
             catch (System.Exception ex)
@@ -2276,6 +2273,55 @@
         }
         #endregion
 
+        #region æŒ‡å®šæœŸãƒ»æŒ‡å®šå¹´åº¦ã�®æœŸé¦–æ—¥ãƒ»æœŸæœ«æ—¥ã‚’å�–å¾—ã�™ã‚‹
+        /// <summary>
+        /// æŒ‡å®šæœŸãƒ»æŒ‡å®šå¹´åº¦ã�®æœŸé¦–æ—¥ãƒ»æœŸæœ«æ—¥ã‚’å�–å¾—ã�™ã‚‹
+        /// </summary>
+        /// <param name="nYear"></param>
+        /// <param name="bOpen"></param>
+        /// <param name="bPeriod"></param>
+        /// <returns></returns>
+        public static DateTime GetOpeningEndDate(int nYear, bool bOpen = true, bool bPeriod = true)
+        {
+            try
+            {
+                DateTime dtRet = DateTime.Today;
+
+                string strwork = string.Empty;
+                int TargetYear = DateTime.Today.Year;
+
+                if (bPeriod)
+                {   // å–¶æ¥­æœŸ
+                    strwork = CommonMotions.SystemMasterData.BusinessBeginningDate;
+                    TargetYear = BusinessPeriodToConstructionYears(nYear);
+                }
+                else
+                {   // å·¥äº‹å¹´åº¦
+                    strwork = CommonMotions.SystemMasterData.ConstructionBeginningDate;
+                    TargetYear = nYear;
+                }
+                // æœˆãƒ»æ—¥åˆ†å‰²
+                string[] DateArray = strwork.Split('/');
+
+                // å¹´æœˆæ—¥ä½œæˆ�
+                dtRet = new DateTime(TargetYear, int.Parse(DateArray[0]), int.Parse(DateArray[1]));
+
+                // æœŸæœ«å�–å¾—æ™‚
+                if (!bOpen)
+                {
+                    dtRet = dtRet.AddYears(1).AddDays(-1);
+                }
+
+                return dtRet;
+            }
+            catch (System.Exception ex)
+            {
+                logger.ErrorFormat("ã‚·ã‚¹ãƒ†ãƒ ã‚¨ãƒ©ãƒ¼ï¼š{0}ï¼š{1}", CommonMotions.GetMethodName(), ex.Message);
+                return DateTime.Today;
+            }
+        }
+        #endregion
+
         #region TimeSpanã�‹ã‚‰å¹´æ•°ã‚’å�–å¾—ã�™ã‚‹
         /// <summary>
         /// TimeSpanã�‹ã‚‰å¹´æ•°ã‚’å�–å¾—ã�™ã‚‹
@@ -2643,7 +2689,7 @@
                 strSQL.Append(" ORDER BY A.d, B.STARTDATE DESC) AS AX");
                 strSQL.Append(" GROUP BY AX.hiduke");
                 strSQL.Append(" ORDER BY AX.hiduke");
-                strSQL.Append(" ) SAL");
+                strSQL.Append(" ) AS SAL");
 
                 ArrayList ArData = new ArrayList();
                 SalDB.ExecuteReader(strSQL.ToString(), ref ArData);
Index: branches/src/ProcessManagement/ProcessManagement/Common/CommonVersion.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Common/CommonVersion.cs	(revision 260)
+++ branches/src/ProcessManagement/ProcessManagement/Common/CommonVersion.cs	(revision 261)
@@ -14,7 +14,7 @@
         /// <summary>
         /// æœ¬ä½“ãƒ�ãƒ¼ã‚¸ãƒ§ãƒ³
         /// </summary>
-        public static int s_SystemVersion = 70;
+        public static int s_SystemVersion = 71;
 
         /// <summary>
         /// ã‚³ãƒ”ãƒ¼ãƒ»ç’°å¢ƒãƒ�ãƒ¼ã‚¸ãƒ§ãƒ³
Index: branches/src/ProcessManagement/ProcessManagement/Common/Process/ClsExcute.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Common/Process/ClsExcute.cs	(revision 260)
+++ branches/src/ProcessManagement/ProcessManagement/Common/Process/ClsExcute.cs	(revision 261)
@@ -3408,7 +3408,7 @@
                 }
                 if (EditFlg == (int)CommonDefine.ProcessDataEdit.Reference) frm.EditLock = true;
 
-                frm.DivisionCode = (int)CommonDefine.DivisionMasterCodeDefine.OrderDivision;
+                frm.DivisionCode = (int)DivisionMaster.DivisionMasterCodeDefine.OrderDivision;
 
                 frm.ShowDialog();
             }
@@ -3445,7 +3445,7 @@
                 }
                 if (EditFlg == (int)CommonDefine.ProcessDataEdit.Reference) frm.EditLock = true;
 
-                frm.DivisionCode = (int)CommonDefine.DivisionMasterCodeDefine.ConstructionExpenses;
+                frm.DivisionCode = (int)DivisionMaster.DivisionMasterCodeDefine.ConstructionExpenses;
 
                 frm.ShowDialog();
             }
Index: branches/src/ProcessManagement/ProcessManagement/DataModel/DivisionMaster.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/DataModel/DivisionMaster.cs	(revision 260)
+++ branches/src/ProcessManagement/ProcessManagement/DataModel/DivisionMaster.cs	(revision 261)
@@ -10,6 +10,35 @@
     /// </summary>
     public class DivisionMaster
     {
+        #region å®šæ•°
+        /// <summary>
+        /// åŒºåˆ†ãƒžã‚¹ã‚¿åŒºåˆ†
+        /// </summary>
+        public enum DivisionMasterCodeDefine
+        {
+            /// <summary>
+            /// ç™ºæ³¨è€…åŒºåˆ†ç™»éŒ²
+            /// </summary>
+            OrderDivision = 1,
+            /// <summary>
+            /// å·¥äº‹ç¨®åˆ¥ç™»éŒ²
+            /// </summary>
+            ConstructionClass = 2,
+            /// <summary>
+            /// å·¥äº‹çµŒè²»å��ç§°ç™»éŒ²
+            /// </summary>
+            ConstructionExpenses = 3,
+        }
+        /// <summary>
+        /// åŒºåˆ†ãƒžã‚¹ã‚¿åŒºåˆ†ã‚­ãƒ¼
+        /// </summary>
+        public static Dictionary<int, string> DivisionMasterCode = new Dictionary<int, string>(){
+                                                                                {1, "ç™ºæ³¨è€…åŒºåˆ†ç™»éŒ²"},
+                                                                                {2, "å·¥äº‹ç¨®åˆ¥ç™»éŒ²"},
+                                                                                {3, "å·¥äº‹çµŒè²»å��ç§°ç™»éŒ²"},
+                                                                                };
+        #endregion
+
         #region ãƒ¡ãƒ³ãƒ�å¤‰æ•°
         private int         m_DivisionCode = 0;	                // åŒºåˆ†ã‚³ãƒ¼ãƒ‰
         private int         m_NameCode = 0;	                    // å��ç§°ã‚³ãƒ¼ãƒ‰
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstractionList/FrmConstructionList.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstractionList/FrmConstructionList.cs	(revision 260)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstractionList/FrmConstructionList.cs	(revision 261)
@@ -311,12 +311,7 @@
         #endregion
 
         #region •”��ƒRƒ“ƒ{ƒ{ƒbƒNƒX•Ï�X
-        /// <summary>
-        /// •”��ƒRƒ“ƒ{ƒ{ƒbƒNƒX•Ï�X
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void cmbDepartment_TextChanged(object sender, EventArgs e)
+        private void cmbDepartment_SelectedIndexChanged(object sender, EventArgs e)
         {
             if (m_initDataLoad) return;
 
@@ -326,15 +321,11 @@
             // ƒf�[ƒ^•\Ž¦
             DataDisplay();
         }
+
         #endregion
 
         #region ’S“–ŽÒƒRƒ“ƒ{ƒ{ƒbƒNƒX•Ï�X
-        /// <summary>
-        /// ’S“–ŽÒ•Ï�X
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void cmbConstructionPerson_TextChanged(object sender, EventArgs e)
+        private void cmbConstructionPerson_SelectedIndexChanged(object sender, EventArgs e)
         {
             if (m_initDataLoad) return;
 
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstractionList/FrmConstructionList.designer.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstractionList/FrmConstructionList.designer.cs	(revision 260)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstractionList/FrmConstructionList.designer.cs	(revision 261)
@@ -28,19 +28,19 @@
         /// </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 dataGridViewCellStyle13 = 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 dataGridViewCellStyle27 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle28 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle39 = 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();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle36 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle37 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle38 = new System.Windows.Forms.DataGridViewCellStyle();
             this.btnDataEntry = new System.Windows.Forms.Button();
             this.btnEnd = new System.Windows.Forms.Button();
             this.label1 = new System.Windows.Forms.Label();
@@ -239,7 +239,7 @@
             this.cmbConstructionPerson.Name = "cmbConstructionPerson";
             this.cmbConstructionPerson.Size = new System.Drawing.Size(200, 23);
             this.cmbConstructionPerson.TabIndex = 2;
-            this.cmbConstructionPerson.TextChanged += new System.EventHandler(this.cmbConstructionPerson_TextChanged);
+            this.cmbConstructionPerson.SelectedIndexChanged += new System.EventHandler(this.cmbConstructionPerson_SelectedIndexChanged);
             // 
             // cmbDepartment
             // 
@@ -251,7 +251,7 @@
             this.cmbDepartment.Name = "cmbDepartment";
             this.cmbDepartment.Size = new System.Drawing.Size(200, 23);
             this.cmbDepartment.TabIndex = 1;
-            this.cmbDepartment.TextChanged += new System.EventHandler(this.cmbDepartment_TextChanged);
+            this.cmbDepartment.SelectedIndexChanged += new System.EventHandler(this.cmbDepartment_SelectedIndexChanged);
             // 
             // label2
             // 
@@ -310,21 +310,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;
+            dataGridViewCellStyle27.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
+            this.dgvMaster.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle27;
             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.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
             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;
+            dataGridViewCellStyle28.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+            dataGridViewCellStyle28.BackColor = System.Drawing.SystemColors.Control;
+            dataGridViewCellStyle28.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+            dataGridViewCellStyle28.ForeColor = System.Drawing.SystemColors.WindowText;
+            dataGridViewCellStyle28.SelectionBackColor = System.Drawing.SystemColors.Highlight;
+            dataGridViewCellStyle28.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
+            dataGridViewCellStyle28.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
+            this.dgvMaster.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle28;
             this.dgvMaster.ColumnHeadersHeight = 24;
             this.dgvMaster.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
             this.dgvMaster.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
@@ -339,14 +339,14 @@
             this.Column3,
             this.Column2,
             this.Column11});
-            dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
-            dataGridViewCellStyle13.BackColor = System.Drawing.SystemColors.Window;
-            dataGridViewCellStyle13.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
-            dataGridViewCellStyle13.ForeColor = System.Drawing.SystemColors.ControlText;
-            dataGridViewCellStyle13.SelectionBackColor = System.Drawing.Color.LightSeaGreen;
-            dataGridViewCellStyle13.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
-            dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
-            this.dgvMaster.DefaultCellStyle = dataGridViewCellStyle13;
+            dataGridViewCellStyle39.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
+            dataGridViewCellStyle39.BackColor = System.Drawing.SystemColors.Window;
+            dataGridViewCellStyle39.Font = new System.Drawing.Font("ï¼­ï¼³ æ˜Žæœ�", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+            dataGridViewCellStyle39.ForeColor = System.Drawing.SystemColors.ControlText;
+            dataGridViewCellStyle39.SelectionBackColor = System.Drawing.Color.LightSeaGreen;
+            dataGridViewCellStyle39.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
+            dataGridViewCellStyle39.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
+            this.dgvMaster.DefaultCellStyle = dataGridViewCellStyle39;
             this.dgvMaster.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter;
             this.dgvMaster.Location = new System.Drawing.Point(10, 103);
             this.dgvMaster.MultiSelect = false;
@@ -362,8 +362,8 @@
             // 
             // Column1
             // 
-            dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
-            this.Column1.DefaultCellStyle = dataGridViewCellStyle3;
+            dataGridViewCellStyle29.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+            this.Column1.DefaultCellStyle = dataGridViewCellStyle29;
             this.Column1.Frozen = true;
             this.Column1.HeaderText = "â„–";
             this.Column1.Name = "Column1";
@@ -374,8 +374,8 @@
             // 
             // Column9
             // 
-            dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
-            this.Column9.DefaultCellStyle = dataGridViewCellStyle4;
+            dataGridViewCellStyle30.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+            this.Column9.DefaultCellStyle = dataGridViewCellStyle30;
             this.Column9.Frozen = true;
             this.Column9.HeaderText = "å–¶æ¥­éƒ¨ç½²";
             this.Column9.Name = "Column9";
@@ -385,8 +385,8 @@
             // 
             // Column5
             // 
-            dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
-            this.Column5.DefaultCellStyle = dataGridViewCellStyle5;
+            dataGridViewCellStyle31.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+            this.Column5.DefaultCellStyle = dataGridViewCellStyle31;
             this.Column5.Frozen = true;
             this.Column5.HeaderText = "å–¶æ¥­æ‹…å½“è€…";
             this.Column5.Name = "Column5";
@@ -397,8 +397,8 @@
             // 
             // Column10
             // 
-            dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
-            this.Column10.DefaultCellStyle = dataGridViewCellStyle6;
+            dataGridViewCellStyle32.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+            this.Column10.DefaultCellStyle = dataGridViewCellStyle32;
             this.Column10.Frozen = true;
             this.Column10.HeaderText = "å·¥äº‹éƒ¨ç½²";
             this.Column10.Name = "Column10";
@@ -408,8 +408,8 @@
             // 
             // Column6
             // 
-            dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
-            this.Column6.DefaultCellStyle = dataGridViewCellStyle7;
+            dataGridViewCellStyle33.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+            this.Column6.DefaultCellStyle = dataGridViewCellStyle33;
             this.Column6.Frozen = true;
             this.Column6.HeaderText = "å·¥äº‹æ‹…å½“è€…";
             this.Column6.Name = "Column6";
@@ -420,8 +420,8 @@
             // 
             // Column4
             // 
-            dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
-            this.Column4.DefaultCellStyle = dataGridViewCellStyle8;
+            dataGridViewCellStyle34.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
+            this.Column4.DefaultCellStyle = dataGridViewCellStyle34;
             this.Column4.Frozen = true;
             this.Column4.HeaderText = "å·¥ã€€äº‹ã€€å��ã€€ç§°";
             this.Column4.Name = "Column4";
@@ -432,8 +432,8 @@
             // 
             // Column7
             // 
-            dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
-            this.Column7.DefaultCellStyle = dataGridViewCellStyle9;
+            dataGridViewCellStyle35.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+            this.Column7.DefaultCellStyle = dataGridViewCellStyle35;
             this.Column7.Frozen = true;
             this.Column7.HeaderText = "æ–½å·¥çŠ¶æ…‹";
             this.Column7.Name = "Column7";
@@ -444,8 +444,8 @@
             // 
             // Column8
             // 
-            dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
-            this.Column8.DefaultCellStyle = dataGridViewCellStyle10;
+            dataGridViewCellStyle36.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+            this.Column8.DefaultCellStyle = dataGridViewCellStyle36;
             this.Column8.Frozen = true;
             this.Column8.HeaderText = "å�°åˆ·";
             this.Column8.Name = "Column8";
@@ -456,8 +456,8 @@
             // 
             // Column3
             // 
-            dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
-            this.Column3.DefaultCellStyle = dataGridViewCellStyle11;
+            dataGridViewCellStyle37.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+            this.Column3.DefaultCellStyle = dataGridViewCellStyle37;
             this.Column3.Frozen = true;
             this.Column3.HeaderText = "å–¶æ¥­æœŸ";
             this.Column3.Name = "Column3";
@@ -469,8 +469,8 @@
             // 
             // Column2
             // 
-            dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
-            this.Column2.DefaultCellStyle = dataGridViewCellStyle12;
+            dataGridViewCellStyle38.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+            this.Column2.DefaultCellStyle = dataGridViewCellStyle38;
             this.Column2.Frozen = true;
             this.Column2.HeaderText = "å·¥äº‹ã‚³ãƒ¼ãƒ‰";
             this.Column2.Name = "Column2";
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionBaseInfo/DataChange.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionBaseInfo/DataChange.cs	(revision 260)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionBaseInfo/DataChange.cs	(revision 261)
@@ -398,11 +398,11 @@
                 strSQL += " LEFT JOIN PERSONINCHARGEMASTER D ON D.PERSONCODE = A.CONSTRUCTIONINSTRUCTOR";
                 strSQL += " , PERSONINCHARGEMASTER B";
                 strSQL += string.Format(" LEFT JOIN DEPARTMENTEXPENSESMASTER E ON E.DEPARTMENTCODE = B.DEPARTMENTCODE AND E.EXPENSESPERIOD = {0} AND E.NAMECODE = 3", ConstrPeriod);
-                strSQL += string.Format(" LEFT JOIN DIVISIONMASTER E1 ON E1.DIVISIONCODE = {0} AND E1.NAMECODE = E.NAMECODE", (int)CommonDefine.DivisionMasterCodeDefine.ConstructionExpenses);
+                strSQL += string.Format(" LEFT JOIN DIVISIONMASTER E1 ON E1.DIVISIONCODE = {0} AND E1.NAMECODE = E.NAMECODE", (int)DivisionMaster.DivisionMasterCodeDefine.ConstructionExpenses);
                 strSQL += string.Format(" LEFT JOIN DEPARTMENTEXPENSESMASTER F ON F.DEPARTMENTCODE = B.DEPARTMENTCODE AND F.EXPENSESPERIOD = {0} AND F.NAMECODE = 1", ConstrPeriod);
-                strSQL += string.Format(" LEFT JOIN DIVISIONMASTER F1 ON F1.DIVISIONCODE = {0} AND F1.NAMECODE = F.NAMECODE", (int)CommonDefine.DivisionMasterCodeDefine.ConstructionExpenses);
+                strSQL += string.Format(" LEFT JOIN DIVISIONMASTER F1 ON F1.DIVISIONCODE = {0} AND F1.NAMECODE = F.NAMECODE", (int)DivisionMaster.DivisionMasterCodeDefine.ConstructionExpenses);
                 strSQL += string.Format(" LEFT JOIN DEPARTMENTEXPENSESMASTER G ON G.DEPARTMENTCODE = B.DEPARTMENTCODE AND G.EXPENSESPERIOD = {0} AND G.NAMECODE = 2", ConstrPeriod);
-                strSQL += string.Format(" LEFT JOIN DIVISIONMASTER G1 ON G1.DIVISIONCODE = {0} AND G1.NAMECODE = G.NAMECODE", (int)CommonDefine.DivisionMasterCodeDefine.ConstructionExpenses);
+                strSQL += string.Format(" LEFT JOIN DIVISIONMASTER G1 ON G1.DIVISIONCODE = {0} AND G1.NAMECODE = G.NAMECODE", (int)DivisionMaster.DivisionMasterCodeDefine.ConstructionExpenses);
                 strSQL += string.Format(" WHERE A.CONSTRUCTIONCODE = {0}", ConstrCode);
                 strSQL += " AND B.PERSONCODE = A.CONSTRUCTIONPERSONCODE";
             }
@@ -614,7 +614,7 @@
                 strSQL += " LEFT OUTER JOIN";
                 strSQL += string.Format(" (SELECT NAMECODE, DEPARTMENTCODE, EXPENSESRAITO FROM DEPARTMENTEXPENSESMASTER WHERE DEPARTMENTCODE = {0}) B", DepartmentCode);
                 strSQL += " ON A.NAMECODE = B.NAMECODE";
-                strSQL += string.Format(" WHERE A.DIVISIONCODE = {0}", (int)CommonDefine.DivisionMasterCodeDefine.ConstructionExpenses);
+                strSQL += string.Format(" WHERE A.DIVISIONCODE = {0}", (int)DivisionMaster.DivisionMasterCodeDefine.ConstructionExpenses);
                 strSQL += " ORDER BY A.DISPLAYORDER";
                 if (!expDB.ExecuteReader(strSQL, ref ExpensesList)) return false;
                 if (ExpensesList.Count == 0) return false;
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionBaseInfo/FrmConstructionBaseInfoAuxiliary.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionBaseInfo/FrmConstructionBaseInfoAuxiliary.cs	(revision 260)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionBaseInfo/FrmConstructionBaseInfoAuxiliary.cs	(revision 261)
@@ -2470,7 +2470,7 @@
                 // Value‚©‚çKey‚ðŒŸ�õ
                 //string DivisionName = CommonDefine.DivisionMasterCode[1];
                 //int DivisionCode = CommonDefine.DivisionMasterCode.First(x => x.Value == DivisionName).Key;
-                string strSQL = dvDB.CreatePrimarykeyString((int)CommonDefine.DivisionMasterCodeDefine.OrderDivision) + " And DeleteFlg = 0 ORDER BY DISPLAYORDER";
+                string strSQL = dvDB.CreatePrimarykeyString((int)DivisionMaster.DivisionMasterCodeDefine.OrderDivision) + " And DeleteFlg = 0 ORDER BY DISPLAYORDER";
                 if (!dvDB.SelectAction(strSQL, ref bvList)) return;
                 if (bvList.Count == 0) return;
 
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionBudget/FrmConstructionBudgetAuxiliary.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionBudget/FrmConstructionBudgetAuxiliary.cs	(revision 260)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionBudget/FrmConstructionBudgetAuxiliary.cs	(revision 261)
@@ -254,7 +254,7 @@
                 strSQL += string.Format(" FROM DEPARTMENTEXPENSESMASTER WHERE DEPARTMENTCODE = {0}) B", picRec.DepartmentCode);
                 strSQL += " ON A.NAMECODE = B.NAMECODE";
                 strSQL += string.Format(" AND B.EXPENSESPERIOD = {0}", m_ConstructionBaseInfo.ConstructionPeriod);
-                strSQL += string.Format(" WHERE A.DIVISIONCODE = {0}", (int)CommonDefine.DivisionMasterCodeDefine.ConstructionExpenses);
+                strSQL += string.Format(" WHERE A.DIVISIONCODE = {0}", (int)DivisionMaster.DivisionMasterCodeDefine.ConstructionExpenses);
                 strSQL += " ORDER BY A.DISPLAYORDER";
                 if (!expDB.ExecuteReader(strSQL, ref m_ExpensesList)) return false;
                 if (m_ExpensesList.Count == 0) return false;
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionJoin/FrmJoinSelect.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionJoin/FrmJoinSelect.cs	(revision 260)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionJoin/FrmJoinSelect.cs	(revision 261)
@@ -260,7 +260,7 @@
                 string strSQL = "SELECT A.NAMESTRING, B.ORDERERSNAME1, B.ORDERERSNAME2";
                 strSQL += " FROM DIVISIONMASTER A, ORDERERSMASTER B";
                 strSQL += string.Format(" WHERE (A.DIVISIONCODE = {0} AND A.NAMECODE = {1})"
-                                        , (int)CommonDefine.DivisionMasterCodeDefine.OrderDivision
+                                        , (int)DivisionMaster.DivisionMasterCodeDefine.OrderDivision
                                         , m_OrderersDivision);
                 strSQL += string.Format(" AND B.ORDERCOTEGORY = A.NAMECODE AND B.ORDERERSCODE = {0}", m_OrdererCode);
                 ArrayList arList = new ArrayList();
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedger/FrmConstructionLedgerAuxiliary.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedger/FrmConstructionLedgerAuxiliary.cs	(revision 260)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedger/FrmConstructionLedgerAuxiliary.cs	(revision 261)
@@ -122,7 +122,7 @@
                 strSQL += string.Format(" FROM DEPARTMENTEXPENSESMASTER WHERE DEPARTMENTCODE = {0}) B", picRec.DepartmentCode);
                 strSQL += " ON A.NAMECODE = B.NAMECODE";
                 strSQL += string.Format(" AND B.EXPENSESPERIOD = {0}", m_ConstructionBaseInfo.ConstructionPeriod);
-                strSQL += string.Format(" WHERE A.DIVISIONCODE = {0}", (int)CommonDefine.DivisionMasterCodeDefine.ConstructionExpenses);
+                strSQL += string.Format(" WHERE A.DIVISIONCODE = {0}", (int)DivisionMaster.DivisionMasterCodeDefine.ConstructionExpenses);
                 strSQL += " ORDER BY A.DISPLAYORDER";
                 if (!expDB.ExecuteReader(strSQL, ref m_ExpensesList)) return false;
                 if (m_ExpensesList.Count == 0) return false;
@@ -1595,7 +1595,7 @@
             IOConstructionBudgetDetail DetailDB = new IOConstructionBudgetDetail();
             try
             {
-                int DivCode = CommonDefine.DivisionMasterCode.First(x => x.Value.Equals("å·¥äº‹çµŒè²»å��ç§°ç™»éŒ²")).Key;
+                int DivCode = DivisionMaster.DivisionMasterCode.First(x => x.Value.Equals("å·¥äº‹çµŒè²»å��ç§°ç™»éŒ²")).Key;
                 string strSQL = "SELECT B.NAMESTRING, A.AMOUNTCONFIGRATE, A.COMPONENTCODE";
                 strSQL += " FROM CONSTRUCTIONBUDGETDETAIL A, DIVISIONMASTER B";
                 strSQL += DetailDB.CreatePrimarykeyString(m_ConstructionCode, (int)FrmConstructionBudget.DataGroup.Expenses, 0, "A");
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedgerList/CreateLedgerSQL.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedgerList/CreateLedgerSQL.cs	(nonexistent)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedgerList/CreateLedgerSQL.cs	(revision 261)
@@ -0,0 +1,670 @@
+ï»¿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,
+        }
+        #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 = DateTime.MinValue;
+                DateTime dtDefaultEnd = DateTime.MinValue;
+                CreateDefaultStartAndEndDate(BusinessPeriod, ref dtDefaultStart, ref dtDefaultEnd);
+                strSQL.Append("Select");
+                strSQL.Append(" Person.DepartmentCode");
+                strSQL.Append(", Person.PersonCode");
+                strSQL.Append(", Person.PersonName");
+                strSQL.Append(", Person.DisplayOrder");
+                strSQL.Append(", Person.MonthlySalary");
+                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 (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}) As Ledger", BusinessPeriod);
+                strSQL.Append(" Group By Ledger.PersonCode) As Detail");
+                strSQL.Append(" ON Detail.PersonCode = Person.PersonCode");
+                strSQL.AppendFormat(" Where Person.LEDGERFLG = {0}", (int)CommonDefine.PersonLedgerDivNo.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.Append(" AND Person.DEPARTMENTCODE IN");
+                    strSQL.Append(" (SELECT AA.DEPARTMENTCODE FROM (SELECT A.DEPARTMENTCODE, A.DEPARTMENTSTRING, A.DISPLAYORDER, COUNT(*) CNT");
+                    strSQL.Append(" FROM DEPARTMENTMASTER A, PERSONINCHARGEMASTER B, CONSTRUCTIONBASEINFO C , CONSTRUCTIONLEDGERDETAIL D");
+                    strSQL.Append(" WHERE A.DELETEFLG = 0");
+                    strSQL.Append(" AND A.DEPARTMENTCODE = B.DEPARTMENTCODE");
+                    strSQL.Append(" AND B.PERSONCODE = C.CONSTRUCTIONPERSONCODE");
+                    strSQL.Append(" AND D.CONSTRUCTIONCODE = C.CONSTRUCTIONCODE");
+
+                    strSQL.Append(" GROUP BY A.DEPARTMENTCODE, A.DEPARTMENTSTRING, A.DISPLAYORDER) AA)");
+                }
+                else
+                {
+                    // éƒ¨ç½²ã‚³ãƒ¼ãƒ‰é�¸æŠžæ™‚ã�¯éƒ¨ç½²ã‚’æ¤œç´¢æ�¡ä»¶ã�¸å…¥ã‚Œã‚‹
+                    strSQL.AppendFormat(" AND Person.DEPARTMENTCODE = {0}", DepartmentCode);
+                }
+                if (PersonCode != 0) strSQL.AppendFormat(" AND Person.PERSONCODE = {0}", PersonCode);
+
+                strSQL.AppendFormat(" And ((DATE(Person.StartDate) <= DATE ('{0}') And DATE (Person.EndDate) = DATE ('{1}'))"
+                                    , dtDefaultStart.ToShortDateString()
+                                    , DateTime.MinValue.ToShortDateString());
+
+                strSQL.AppendFormat(" Or (DATE('{0}') <= DATE(Person.StartDate) And DATE(Person.StartDate) <= DATE('{1}'))"
+                                    , dtDefaultStart.ToShortDateString()
+                                    , dtDefaultEnd.ToShortDateString());
+
+                strSQL.AppendFormat(" Or (DATE('{0}') <= DATE(Person.EndDate) And DATE(Person.EndDate) <= DATE('{1}')))"
+                                    , dtDefaultStart.ToShortDateString()
+                                    , dtDefaultEnd.ToShortDateString());
+
+                strSQL.AppendFormat(" ORDER BY 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>
+        /// <param name="dtStart"></param>
+        /// <param name="dtEnd"></param>
+        public static void CreateDefaultStartAndEndDate(int BusinessPeriod, ref DateTime dtStart, ref DateTime dtEnd)
+        {
+            try
+            {
+                // å½“æœŸæœŸé¦–å¹´æœˆæ—¥ã‚’å�–å¾—
+                int iYear = 0;
+                int month = 0;
+                int day = 0;
+                bool bPeriod = false;
+                if (CommonMotions.SystemMasterData.ConstructionNoBase == (int)CommonDefine.SystemConstructionNoBase.BusinessPeriod)
+                {   // å–¶æ¥­æœŸ
+                    iYear = CommonMotions.PeriodCountToYear(BusinessPeriod);
+                    bPeriod = true;
+                }
+                else
+                {   // å·¥äº‹å¹´åº¦
+                    iYear = CommonMotions.SystemMasterData.ConstructionYear;
+                }
+                CommonMotions.GetBeginningMonthDay(bPeriod, ref month, ref day);
+                dtStart = new DateTime(iYear, month, day);
+                dtEnd = dtStart.AddYears(1).AddDays(-1);     // çµ‚äº†ã�¯ï¼‹1å¹´ï¼�1æ—¥
+            }
+            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,
+                                        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 (CompDate.Date > DateTime.Today.Date) return;
+
+                if (BusinessPeriod != CommonMotions.SystemMasterData.BusinessPeriod)
+                {   // ä»ŠæœŸä»¥å¤–ã�¯ã�¯æœŸæœ«
+                    CompDate = dtDefaultEnd;
+
+                    // é€€ç¤¾æ—¥ã�ŒæœŸå†…ã�ªã‚‰ã�°çµ‚äº†ã‚’é€€ç¤¾æ—¥ã�«ã�™ã‚‹
+                    if (dtDefaultStart < HireCompDate && HireCompDate < dtDefaultEnd) CompDate = HireCompDate;
+                }
+                else
+                {   // ä»¥å¤–ã�¯ä»Šæ—¥
+                    CompDate = DateTime.Today.Date;
+
+                    // é€€ç¤¾æ—¥ã�ŒæœŸå†…ã�ªã‚‰ã�°çµ‚äº†ã‚’é€€ç¤¾æ—¥ã�«ã�™ã‚‹
+                    if (dtDefaultStart < HireCompDate && HireCompDate < dtDefaultEnd) CompDate = HireCompDate;
+                }
+            }
+            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)
+        {
+            try
+            {
+                // éƒ¨ç½²ã‚³ãƒ¼ãƒ‰å�–å¾—
+                int NotOrder = CommonDefine.ProjectsStatus.First(x => x.Value.Equals("é�ž å�— æ³¨")).Key;
+
+                // æŒ¯åˆ†çµ¦ä¸Žé‡‘é¡�å�–å¾—
+                StringBuilder strSQL = new StringBuilder();
+                //strSQL.Append("SELECT SUM(C.EXECUTIONAMOUNT) FROM");
+                strSQL.Append("SELECT SUM(C2.PaymentAmount) FROM");
+                strSQL.Append(" CONSTRUCTIONLEDGER P");
+                strSQL.Append(", CONSTRUCTIONBASEINFO B");
+                strSQL.Append(", CONSTRUCTIONLEDGERDETAIL C");
+                strSQL.Append(" LEFT JOIN constructionledgerexcute C2");
+                strSQL.Append(" ON C2.ConstructionCode = C.ConstructionCode");
+                strSQL.Append(" And C2.GroupCount = C.GroupCount");
+                strSQL.Append(" And C2.LineCount = C.LineCount");
+                strSQL.Append(", PERSONINCHARGEMASTER D");
+                // æŒ¯åˆ†ç„¡ã�§ã�¯ç„¡ã�„
+                strSQL.Append(" WHERE P.CONSTRUCTIONCODE IN (SELECT A.CONSTRUCTIONCODE FROM CONSTRUCTIONLEDGERDETAIL A");
+                strSQL.AppendFormat(" WHERE A.GROUPCOUNT = {0} AND (A.SALARYFLG = {1} OR A.SALARYFLG = {2}))"
+                                        , (int)FrmConstructionLedger.DataGroup.Payroll
+                                        , (int)CommonDefine.SalaryDevision.All
+                                        , (int)CommonDefine.SalaryDevision.DaysInput);
+
+                strSQL.Append(" AND P.CONSTRUCTIONCODE = B.CONSTRUCTIONCODE");
+                strSQL.AppendFormat(" AND B.CONSTRUCTIONPERIOD = {0}", ConstructionPeriod);
+                strSQL.AppendFormat(" AND B.CONSTRUCTIONSTATUSFLG != {0}", NotOrder);
+                strSQL.Append(" AND C.CONSTRUCTIONCODE = P.CONSTRUCTIONCODE");
+                strSQL.AppendFormat(" AND C.GROUPCOUNT = {0}", (int)FrmConstructionLedger.DataGroup.Payroll);
+                strSQL.Append(" AND D.PERSONCODE = C.CompanyCode");
+
+                if (CommonMotions.LoginUserData.PersonCode != CommonDefine.AdminCode)
+                {
+                    strSQL.Append(" AND D.DEPARTMENTCODE IN (select PDep.DepartmentCode from PersonDepartmentMaster AS PDep");
+                    strSQL.AppendFormat(" WHERE PDep.PersonCode = {0})", CommonMotions.LoginUserData.PersonCode);
+                }
+
+                if (DepartmentCode != 0) strSQL.AppendFormat(" AND D.DEPARTMENTCODE = {0}", DepartmentCode);
+                if (PersonCode != 0) strSQL.AppendFormat(" AND D.PERSONCODE = {0}", 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");
+                strSQL.Append(" Where");
+                
+                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);
+                }
+                strSQL.Append(strSub.ToString());
+
+                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();
+                CostDB.ExecuteReader(strSQL.ToString(), ref arList);
+
+                // å�–å¾—çµ�æžœã‚’æŒ¯ã‚Šåˆ†ã�‘ã‚‹
+                foreach (object[] wrkobj in arList)
+                {
+                    for (int i = 1; i < CommonDefine.CostDataNoString.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>
+        private enum GetPersonTermOLD
+        {
+            DepartmentCode = 0,
+            /// <summary>
+            /// æ‹…å½“è€…ã‚³ãƒ¼ãƒ‰
+            /// </summary>
+            PersonCode,
+            /// <summary>
+            /// æ‹…å½“è€…å��
+            /// </summary>
+            Personname,
+            /// <summary>
+            /// è¡¨ç¤ºé †
+            /// </summary>
+            Displayorder,
+            /// <summary>
+            /// æœˆé¡�çµ¦ä¸Ž
+            /// </summary>
+            MonthlySalary,
+            /// <summary>
+            /// é›‡ç”¨é–‹å§‹æ—¥ä»˜
+            /// </summary>
+            HireStartDays,
+            /// <summary>
+            /// é›‡ç”¨çµ‚äº†æ—¥ä»˜
+            /// </summary>
+            HireCompDays,
+            /// <summary>
+            /// æ‹…å½“è€…å¥‘ç´„å·¥æœŸé–‹å§‹
+            /// </summary>
+            MainStart1,
+            /// <summary>
+            /// æ‹…å½“è€…å¥‘ç´„å·¥æœŸå»¶é•·é–‹å§‹
+            /// </summary>
+            MainStart2,
+            /// <summary>
+            /// å‰¯æ‹…å½“è€…å¥‘ç´„å·¥æœŸé–‹å§‹
+            /// </summary>
+            AssistStart1,
+            /// <summary>
+            /// å‰¯æ‹…å½“è€…å¥‘ç´„å·¥æœŸå»¶é•·é–‹å§‹
+            /// </summary>
+            AssistStart2,
+            /// <summary>
+            /// æŒ‡å°Žå“¡å¥‘ç´„å·¥æœŸé–‹å§‹
+            /// </summary>
+            InstStart1,
+            /// <summary>
+            /// æŒ‡å°Žå“¡å¥‘ç´„å·¥æœŸå»¶é•·é–‹å§‹
+            /// </summary>
+            InstStart2,
+            /// <summary>
+            /// æ‹…å½“è€…å¥‘ç´„å·¥æœŸçµ‚äº†
+            /// </summary>
+            MainEnd1,
+            /// <summary>
+            /// æ‹…å½“è€…å¥‘ç´„å·¥æœŸå»¶é•·çµ‚äº†
+            /// </summary>
+            MainEnd2,
+            /// <summary>
+            /// å‰¯æ‹…å½“è€…å¥‘ç´„å·¥æœŸçµ‚äº†
+            /// </summary>
+            AssistEnd1,
+            /// <summary>
+            /// å‰¯æ‹…å½“è€…å¥‘ç´„å·¥æœŸå»¶é•·çµ‚äº†
+            /// </summary>
+            AssistEnd2,
+            /// <summary>
+            /// æŒ‡å°Žå“¡å¥‘ç´„å·¥æœŸçµ‚äº†
+            /// </summary>
+            InstEnd1,
+            /// <summary>
+            /// æŒ‡å°Žå“¡å¥‘ç´„å·¥æœŸå»¶é•·çµ‚äº†
+            /// </summary>
+            InstEnd2,
+            /// <summary>
+            /// æ‹…å½“è€…é‡‘é¡�é›†è¨ˆ
+            /// </summary>
+            MainSumAmount,
+            /// <summary>
+            /// å‰¯æ‹…å½“è€…é‡‘é¡�é›†è¨ˆ
+            /// </summary>
+            AssistSumAmount,
+            /// <summary>
+            /// æŒ‡å°Žå“¡é‡‘é¡�é›†è¨ˆ
+            /// </summary>
+            InstSumAmount,
+            /// <summary>
+            /// æ‹…å½“è€…ãƒ‡ãƒ¼ã‚¿ä»¶æ•°
+            /// </summary>
+            MainDataCount,
+            /// <summary>
+            /// å‰¯æ‹…å½“è€…ãƒ‡ãƒ¼ã‚¿ä»¶æ•°
+            /// </summary>
+            AssistDataCmount,
+            /// <summary>
+            /// æŒ‡å°Žå“¡ãƒ‡ãƒ¼ã‚¿ä»¶æ•°
+            /// </summary>
+            InstDataCmount,
+        }
+        #endregion
+
+        #region éƒ¨ç½²å†…ã�®æ‹…å½“è€…ã‚³ãƒ¼ãƒ‰ã‚’ä¸€è¦§ã�§è¿”ã�™ã€€â€»æ—§ãƒ�ãƒ¼ã‚¸ãƒ§ãƒ³
+        /// <summary>
+        /// éƒ¨ç½²å†…ã�®æ‹…å½“è€…ã‚³ãƒ¼ãƒ‰ã‚’ä¸€è¦§ã�§è¿”ã�™
+        /// </summary>
+        /// <param name="DepartmentCode">éƒ¨ç½²ã‚³ãƒ¼ãƒ‰</param>
+        /// <param name="PersonCodeList">æ‹…å½“è€…ã‚³ãƒ¼ãƒ‰ä¸€è¦§</param>
+        /// <returns>ãƒ‡ãƒ¼ã‚¿ä»¶æ•°</returns>
+        public static int GetPersonInDepartment_OLD(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();
+                strSQL.Append("SELECT P.PERSONCODE, P.PERSONNAME, P.DISPLAYORDER, P.MonthlySalary,");
+                strSQL.Append(" P.STARTDATE, P.ENDDATE,");
+                strSQL.Append(" MIN(C.CONSTRUCTIONPERIODSTART) M1, MIN(C.CONSTRUCTIONPERIODSTART2) M2,");
+                strSQL.Append(" MIN(D.CONSTRUCTIONPERIODSTART) S1, MIN(D.CONSTRUCTIONPERIODSTART2) S2,");
+                strSQL.Append(" MIN(E.CONSTRUCTIONPERIODSTART) I1, MIN(E.CONSTRUCTIONPERIODSTART2) I2,");
+                strSQL.Append(" MAX(C.CONSTRUCTIONPERIODEND) M3, MAX(C.CONSTRUCTIONPERIODEND2) M4,");
+                strSQL.Append(" MAX(D.CONSTRUCTIONPERIODEND) S3, MAX(D.CONSTRUCTIONPERIODEND2) S4,");
+                strSQL.Append(" MAX(E.CONSTRUCTIONPERIODEND) I3, MAX(E.CONSTRUCTIONPERIODEND2) I4,");
+                strSQL.Append(" SUM(C.EXECUTIONAMOUNT) M5, SUM(D.EXECUTIONAMOUNT) S5, SUM(E.EXECUTIONAMOUNT) I5,");
+                strSQL.Append(" COUNT(C.EXECUTIONAMOUNT) M6, COUNT(D.EXECUTIONAMOUNT) S6, COUNT(E.EXECUTIONAMOUNT) I6");
+                strSQL.Append(" FROM PERSONINCHARGEMASTER P");
+
+                // å·¥äº‹æ‹…å½“è€…ã�®ãƒ‡ãƒ¼ã‚¿å�–å¾—
+                strSQL.Append(" LEFT JOIN (SELECT C1.CONSTRUCTIONPERSONCODE, C1.CONSTRUCTIONSTATUSFLG, C1.CONSTRUCTIONPERIOD");
+                strSQL.Append(", C1.CONSTRUCTIONPERIODSTART, C1.CONSTRUCTIONPERIODSTART2, C1.CONSTRUCTIONPERIODEND, C1.CONSTRUCTIONPERIODEND2, C2.EXECUTIONAMOUNT");
+                strSQL.Append(" FROM CONSTRUCTIONBASEINFO C1, CONSTRUCTIONLEDGERDETAIL C2, CONSTRUCTIONLEDGER C3");
+                strSQL.Append(" WHERE C2.CONSTRUCTIONCODE = C1.CONSTRUCTIONCODE");
+                strSQL.AppendFormat(" AND C2.GROUPCOUNT = {0}", (int)FrmConstructionLedger.DataGroup.Payroll);
+                strSQL.Append(" AND C3.CONSTRUCTIONCODE = C2.CONSTRUCTIONCODE) C");
+                strSQL.Append(" ON C.CONSTRUCTIONPERSONCODE = P.PERSONCODE");
+                strSQL.AppendFormat(" AND C.CONSTRUCTIONSTATUSFLG <> {0}", NotOrder);
+                strSQL.AppendFormat(" AND C.CONSTRUCTIONPERIOD = {0}", BusinessPeriod);
+
+                // å·¥äº‹å‰¯æ‹…å½“è€…ã�®ãƒ‡ãƒ¼ã‚¿å�–å¾—
+                strSQL.Append(" LEFT JOIN (SELECT D1.CONSTRSUBPERSONCODE CONSTRUCTIONPERSONCODE, D1.CONSTRUCTIONSTATUSFLG, D1.CONSTRUCTIONPERIOD");
+                strSQL.Append(", D1.CONSTRUCTIONPERIODSTART, D1.CONSTRUCTIONPERIODSTART2, D1.CONSTRUCTIONPERIODEND, D1.CONSTRUCTIONPERIODEND2, D2.EXECUTIONAMOUNT");
+                strSQL.Append(" FROM CONSTRUCTIONBASEINFO D1, CONSTRUCTIONLEDGERDETAIL D2, CONSTRUCTIONLEDGER D3");
+                strSQL.Append(" WHERE D2.CONSTRUCTIONCODE = D1.CONSTRUCTIONCODE");
+                strSQL.AppendFormat(" AND D2.GROUPCOUNT = {0}", (int)FrmConstructionLedger.DataGroup.Assistant);
+                strSQL.Append(" AND D3.CONSTRUCTIONCODE = D2.CONSTRUCTIONCODE) D");
+                strSQL.Append(" ON D.CONSTRUCTIONPERSONCODE = P.PERSONCODE");
+                strSQL.AppendFormat(" AND D.CONSTRUCTIONSTATUSFLG <> {0}", NotOrder);
+                strSQL.AppendFormat(" AND D.CONSTRUCTIONPERIOD = {0}", BusinessPeriod);
+
+                // å·¥äº‹æŒ‡å°Žå“¡ã�®ãƒ‡ãƒ¼ã‚¿å�–å¾—
+                strSQL.Append(" LEFT JOIN (SELECT E1.CONSTRUCTIONINSTRUCTOR CONSTRUCTIONPERSONCODE, E1.CONSTRUCTIONSTATUSFLG, E1.CONSTRUCTIONPERIOD");
+                strSQL.Append(", E1.CONSTRUCTIONPERIODSTART, E1.CONSTRUCTIONPERIODSTART2, E1.CONSTRUCTIONPERIODEND, E1.CONSTRUCTIONPERIODEND2, E2.EXECUTIONAMOUNT");
+                strSQL.Append(" FROM CONSTRUCTIONBASEINFO E1, CONSTRUCTIONLEDGERDETAIL E2, CONSTRUCTIONLEDGER E3");
+                strSQL.Append(" WHERE E2.CONSTRUCTIONCODE = E1.CONSTRUCTIONCODE");
+                strSQL.AppendFormat(" AND E2.GROUPCOUNT = {0}", (int)FrmConstructionLedger.DataGroup.Instructor);
+                strSQL.Append(" AND E3.CONSTRUCTIONCODE = E2.CONSTRUCTIONCODE) E");
+                strSQL.Append(" ON E.CONSTRUCTIONPERSONCODE = P.PERSONCODE");
+                strSQL.AppendFormat(" AND E.CONSTRUCTIONSTATUSFLG <> {0}", NotOrder);
+                strSQL.AppendFormat(" AND E.CONSTRUCTIONPERIOD = {0}", BusinessPeriod);
+
+                strSQL.AppendFormat(" WHERE P.LEDGERFLG = {0}", (int)CommonDefine.PersonLedgerDivNo.CalcTarget);
+
+                // å½“æœŸæœŸé¦–æ—¥ãƒ»æœŸæœ«æ—¥ã‚’å�–å¾—
+                DateTime dtDefaultStart = DateTime.MinValue;
+                DateTime dtDefaultEnd = DateTime.MinValue;
+                CreateDefaultStartAndEndDate(BusinessPeriod, ref dtDefaultStart, ref dtDefaultEnd);
+                strSQL.AppendFormat(" AND (DATE(P.STARTDATE) <= STR_TO_DATE('{0}','%Y/%m/%d')", dtDefaultEnd.ToShortDateString());
+                strSQL.AppendFormat(" AND (STR_TO_DATE('{0}','%Y/%m/%d') <= DATE(P.ENDDATE)", dtDefaultStart.ToShortDateString());
+                strSQL.AppendFormat(" OR STR_TO_DATE('{0}','%Y/%m/%d') = DATE(P.ENDDATE)))", DateTime.MinValue.ToShortDateString());
+                if (CommonMotions.LoginUserData.PersonCode != CommonDefine.AdminCode)
+                {
+                    strSQL.Append(" AND P.DEPARTMENTCODE IN (select PDep.DepartmentCode from PersonDepartmentMaster AS PDep");
+                    strSQL.AppendFormat(" WHERE PDep.PersonCode = {0})", CommonMotions.LoginUserData.PersonCode);
+                }
+
+                // å·¥äº‹å�°å¸³ãƒ‡ãƒ¼ã‚¿ã�®éƒ¨ç½²ã� ã�‘ã�Œå¯¾è±¡
+                if (DepartmentCode == 0)
+                {
+                    strSQL.Append(" AND P.DEPARTMENTCODE IN");
+                    strSQL.Append(" (SELECT TMP.DEPARTMENTCODE FROM (SELECT A.DEPARTMENTCODE, A.DEPARTMENTSTRING, A.DISPLAYORDER, COUNT(*) CNT");
+                    strSQL.Append(" FROM DEPARTMENTMASTER A, PERSONINCHARGEMASTER B, CONSTRUCTIONBASEINFO C , CONSTRUCTIONLEDGERDETAIL D");
+                    strSQL.Append(" WHERE A.DELETEFLG = 0");
+                    strSQL.Append(" AND A.DEPARTMENTCODE = B.DEPARTMENTCODE");
+                    strSQL.Append(" AND B.PERSONCODE = C.CONSTRUCTIONPERSONCODE");
+                    strSQL.Append(" AND D.CONSTRUCTIONCODE = C.CONSTRUCTIONCODE");
+
+                    strSQL.Append(" GROUP BY A.DEPARTMENTCODE, A.DEPARTMENTSTRING, A.DISPLAYORDER) TMP)");
+                }
+                else
+                {
+                    // éƒ¨ç½²ã‚³ãƒ¼ãƒ‰é�¸æŠžæ™‚ã�¯éƒ¨ç½²ã‚’æ¤œç´¢æ�¡ä»¶ã�¸å…¥ã‚Œã‚‹
+                    strSQL.AppendFormat(" AND P.DEPARTMENTCODE = {0}", DepartmentCode);
+                }
+                if (PersonCode != 0) strSQL.AppendFormat(" AND P.PERSONCODE = {0}", PersonCode);
+
+                strSQL.Append(" GROUP BY P.PERSONCODE, P.PERSONNAME, P.DISPLAYORDER, P.MonthlySalary, P.STARTDATE, P.ENDDATE");
+                strSQL.Append(" ORDER BY P.DISPLAYORDER");
+
+                ArrayList arList = new ArrayList();
+                if (!PersonDB.ExecuteReader(strSQL.ToString(), ref arList)) return 0;
+
+                DateTime stDate = DateTime.MaxValue;
+                DateTime edDate = DateTime.MinValue;
+                DateTime maxDate = DateTime.MinValue;
+                foreach (object[] objRec in arList)
+                {
+                    stDate = DateTime.MaxValue;
+                    edDate = DateTime.MinValue;
+                    maxDate = DateTime.MinValue;
+
+                    // æ‹…å½“è€…ã‚³ãƒ¼ãƒ‰ã‚’å�–å¾—ã�™ã‚‹
+                    int Person = CommonMotions.cnvInt(objRec[(int)GetPersonTermOLD.PersonCode]);
+
+                    DateTime wrkDate = DateTime.MinValue;
+                    // æœ€å°�ã�®é–‹å§‹æ—¥ã‚’å�–å¾—ã�™ã‚‹
+                    //stDate = dtDefaultStart;
+                    wrkDate = CommonMotions.cnvDate(objRec[(int)GetPersonTermOLD.MainStart1]).Date;
+                    if (wrkDate != DateTime.MinValue && wrkDate < stDate) stDate = wrkDate;
+                    wrkDate = CommonMotions.cnvDate(objRec[(int)GetPersonTermOLD.MainStart2]).Date;
+                    if (wrkDate != DateTime.MinValue && wrkDate < stDate) stDate = wrkDate;
+
+                    // æœ€å¤§ã�®çµ‚äº†æ—¥ã‚’å�–å¾—ã�™ã‚‹
+                    //maxDate = dtDefaultEnd;
+                    wrkDate = CommonMotions.cnvDate(objRec[(int)GetPersonTermOLD.MainEnd1]).Date;
+                    if (wrkDate != DateTime.MinValue && wrkDate > maxDate) maxDate = wrkDate;
+                    wrkDate = CommonMotions.cnvDate(objRec[(int)GetPersonTermOLD.MainEnd2]).Date;
+                    if (wrkDate != DateTime.MinValue && wrkDate > maxDate) maxDate = wrkDate;
+
+                    // è¨ˆç®—ã�®çµ‚äº†æ—¥ã‚’å�–å¾—ã�™ã‚‹
+                    //edDate = dtDefaultEnd;
+                    // æœˆé¡�çµ¦ä¸Žã‚’å�–å¾—ã�™ã‚‹
+                    int Salary = CommonMotions.cnvInt(objRec[(int)GetPersonTermOLD.MonthlySalary]);
+
+                    // é›‡ç”¨é–‹å§‹ãƒ»çµ‚äº†æ—¥ã‚’å�–å¾—ã�™ã‚‹
+                    DateTime dtHireStDay = CommonMotions.cnvDate(objRec[(int)GetPersonTermOLD.HireStartDays]);
+                    DateTime dtHireEdDay = CommonMotions.cnvDate(objRec[(int)GetPersonTermOLD.HireCompDays]);
+
+                    TargetList.Add(new object[]{Person,         // æ‹…å½“è€…ã‚³ãƒ¼ãƒ‰
+                                                stDate,         // é–‹å§‹æ—¥
+                                                edDate,         // çµ‚äº†æ—¥
+                                                maxDate,        // æœ€å¤§çµ‚äº†æ—¥
+                                                Salary,         // çµ¦ä¸Žé‡‘é¡�
+                                                DateTime.Now,
+                                                DateTime.Now,
+                                                dtHireStDay,    // é›‡ç”¨é–‹å§‹æ—¥
+                                                dtHireEdDay});  // é›‡ç”¨çµ‚äº†æ—¥
+                }
+                return arList.Count;
+            }
+            catch (Exception ex)
+            {
+                logger.ErrorFormat("ã‚·ã‚¹ãƒ†ãƒ ã‚¨ãƒ©ãƒ¼ï¼š{0}ï¼š{1}", CommonMotions.GetMethodName(), ex.Message);
+                return 0;
+            }
+            finally
+            {
+                PersonDB.close(); PersonDB = null;
+            }
+        }
+        #endregion
+    }
+}
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedgerList/FrmConstructionLedgerListAuxiliary.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedgerList/FrmConstructionLedgerListAuxiliary.cs	(revision 260)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedgerList/FrmConstructionLedgerListAuxiliary.cs	(revision 261)
@@ -509,41 +509,6 @@
         }
         #endregion
 
-        #region ƒfƒtƒHƒ‹ƒg‚ÌŠúŽñ“ú�EŠú––“ú‚ð‹�‚ß‚é
-        /// <summary>
-        /// ƒfƒtƒHƒ‹ƒg‚ÌŠúŽñ“ú�EŠú––“ú‚ð‹�‚ß‚é
-        /// </summary>
-        /// <param name="dtStart"></param>
-        /// <param name="dtEnd"></param>
-        private void CreateDefaultStartAndEndDate(ref DateTime dtStart, ref DateTime dtEnd)
-        {
-            try
-            {
-                // “–ŠúŠúŽñ”NŒŽ“ú‚ðŽæ“¾
-                int iYear = 0;
-                int month = 0;
-                int day = 0;
-                bool bPeriod = false;
-                if (CommonMotions.SystemMasterData.ConstructionNoBase == (int)CommonDefine.SystemConstructionNoBase.BusinessPeriod)
-                {   // ‰c‹ÆŠú
-                    iYear = CommonMotions.PeriodCountToYear(CommonMotions.cnvInt(numUDConstPro.Value));
-                    bPeriod = true;
-                }
-                else
-                {   // �HŽ–”N“x
-                    iYear = CommonMotions.SystemMasterData.ConstructionYear;
-                }
-                CommonMotions.GetBeginningMonthDay(bPeriod, ref month, ref day);
-                dtStart = new DateTime(iYear, month, day);
-                dtEnd = dtStart.AddYears(1).AddDays(-1);     // �I—¹‚Í�{1”N�|1“ú
-            }
-            catch (Exception ex)
-            {
-                logger.ErrorFormat("ƒVƒXƒeƒ€ƒGƒ‰�[�F{0}�F{1}", CommonMotions.GetMethodName(), ex.Message);
-            }
-        }
-        #endregion
-
         #region �HŽ–�î•ñ‚æ‚è‚ÌŠúŽñ“ú�EŠú––“ú‚ð‹�‚ß‚é
         /// <summary>
         /// �HŽ–�î•ñ‚æ‚è‚ÌŠúŽñ“ú�EŠú––“ú‚ð‹�‚ß‚é
@@ -590,15 +555,10 @@
         /// <param name="dtStartArray"></param>
         /// <param name="dtCompArray"></param>
         /// <returns></returns>
-        private int SetOtherCost(List<int> PersonCDArray, List<DateTime> dtStartArray, List<DateTime> dtCompArray,  List<DateTime> dtHireStDayArray)
+        private int SetOtherCost(DateTime dtDefaultStart, DateTime dtDefaultEnd, ArrayList TargetList, IOCostDataOfPerson CostDB)
         {
             try
             {
-                // “–ŠúŠúŽñ“ú�EŠú––“ú‚ðŽæ“¾
-                DateTime dtDefaultStart = DateTime.MinValue;
-                DateTime dtDefaultEnd = DateTime.MinValue;
-                CreateDefaultStartAndEndDate(ref dtDefaultStart, ref dtDefaultEnd);
-
                 int ArrayCount = Common.CommonDefine.CostDataNoString.Length;
                 int[] CostValue = new int[ArrayCount];
                 // •\Ž¦ƒGƒŠƒAƒNƒŠƒA
@@ -605,21 +565,21 @@
                 Array.Clear(CostValue, 0, CostValue.Length);
 
                 // �‡Œv‚ð�WŒv‚·‚é
-                for (int ii = 0; ii < PersonCDArray.Count; ii++)
+                DateTime stDate = DateTime.MaxValue;
+                DateTime edDate = DateTime.MaxValue;
+                // for (int ii = 0; ii < PersonCDArray.Count; ii++)
+                foreach (object[] ObjRec in TargetList)
                 {
-                    // ŠJŽn�E�I—¹“ú‚ª–³‚¢�ê�‡‚ÍƒfƒtƒHƒ‹ƒg‚ÌŠúŽñ�EŠú––‚ðŽg—p‚·‚é
-                    //if (dtStartArray[ii] == DateTime.MinValue || dtStartArray[ii] == DateTime.MaxValue) dtStartArray[ii] = dtDefaultStart;
-                    //if (dtCompArray[ii] == DateTime.MinValue || dtCompArray[ii] == DateTime.MaxValue) dtCompArray[ii] = dtDefaultEnd;
-                    // ŠJŽn�E�I—¹“ú‚ª–³‚¢�ê�‡‚ÍƒfƒtƒHƒ‹ƒg‚ÌŠúŽñ�EŠú––‚ðŽg—p‚·‚é
+                    CreateLedgerSQL.CalcStartCompDate((int)numUDConstPro.Value,
+                                                        dtDefaultStart, dtDefaultEnd,
+                                                        CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.HireStartDays]),
+                                                        CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.HireCompDays]),
+                                                        ref stDate, ref edDate);
 
-                    DateTime stDate = dtStartArray[ii];
-                    DateTime edDate = dtCompArray[ii];
-                    CalcStartCompDate(dtDefaultStart, dtDefaultEnd, dtHireStDayArray[ii], dtCompArray[ii], ref stDate, ref edDate);
-
-
                     // Œo”ïŽæ“¾
-                    //GetPersonExpensesCostValue(PersonCDArray[ii], dtStartArray[ii], dtCompArray[ii], ref CostValue);
-                    GetPersonExpensesCostValue(PersonCDArray[ii], stDate, edDate, ref CostValue);
+                    CreateLedgerSQL.GetPersonExpensesCostValue(CostDB, 0,
+                                                CommonMotions.cnvInt(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.PersonCode]),
+                                                dtDefaultStart, dtDefaultEnd, ref CostValue);
                 }
 
                 // ----- Œo”ï‚Ì�WŒv
@@ -726,323 +686,6 @@
         }
         #endregion
 
-        #region ŠúŠÔƒf�[ƒ^Žæ“¾�‡
-        /// <summary>
-        /// ŠúŠÔƒf�[ƒ^Žæ“¾�‡
-        /// </summary>
-        private enum GetPersonTerm
-        {
-            /// <summary>
-            /// ’S“–ŽÒƒR�[ƒh
-            /// </summary>
-            Personcode = 0,
-            /// <summary>
-            /// ’S“–ŽÒ–¼
-            /// </summary>
-            Personname,
-            /// <summary>
-            /// •\Ž¦�‡
-            /// </summary>
-            Displayorder,
-            /// <summary>
-            /// ŒŽŠz‹‹—^
-            /// </summary>
-            MonthlySalary,
-            /// <summary>
-            /// ’S“–ŽÒŒ_–ñ�HŠúŠJŽn
-            /// </summary>
-            MainStart1,
-            /// <summary>
-            /// ’S“–ŽÒŒ_–ñ�HŠú‰„’·ŠJŽn
-            /// </summary>
-            MainStart2,
-            /// <summary>
-            /// •›’S“–ŽÒŒ_–ñ�HŠúŠJŽn
-            /// </summary>
-            AssistStart1,
-            /// <summary>
-            /// •›’S“–ŽÒŒ_–ñ�HŠú‰„’·ŠJŽn
-            /// </summary>
-            AssistStart2,
-            /// <summary>
-            /// Žw“±ˆõŒ_–ñ�HŠúŠJŽn
-            /// </summary>
-            InstStart1,
-            /// <summary>
-            /// Žw“±ˆõŒ_–ñ�HŠú‰„’·ŠJŽn
-            /// </summary>
-            InstStart2,
-            /// <summary>
-            /// ’S“–ŽÒŒ_–ñ�HŠú�I—¹
-            /// </summary>
-            MainEnd1,
-            /// <summary>
-            /// ’S“–ŽÒŒ_–ñ�HŠú‰„’·�I—¹
-            /// </summary>
-            MainEnd2,
-            /// <summary>
-            /// •›’S“–ŽÒŒ_–ñ�HŠú�I—¹
-            /// </summary>
-            AssistEnd1,
-            /// <summary>
-            /// •›’S“–ŽÒŒ_–ñ�HŠú‰„’·�I—¹
-            /// </summary>
-            AssistEnd2,
-            /// <summary>
-            /// Žw“±ˆõŒ_–ñ�HŠú�I—¹
-            /// </summary>
-            InstEnd1,
-            /// <summary>
-            /// Žw“±ˆõŒ_–ñ�HŠú‰„’·�I—¹
-            /// </summary>
-            InstEnd2,
-            /// <summary>
-            /// ’S“–ŽÒ‹àŠz�WŒv
-            /// </summary>
-            MainSumAmount,
-            /// <summary>
-            /// •›’S“–ŽÒ‹àŠz�WŒv
-            /// </summary>
-            AssistSumAmount,
-            /// <summary>
-            /// Žw“±ˆõ‹àŠz�WŒv
-            /// </summary>
-            InstSumAmount,
-            /// <summary>
-            /// ’S“–ŽÒƒf�[ƒ^Œ��”
-            /// </summary>
-            MainDataCount,
-            /// <summary>
-            /// •›’S“–ŽÒƒf�[ƒ^Œ��”
-            /// </summary>
-            AssistDataCmount,
-            /// <summary>
-            /// Žw“±ˆõƒf�[ƒ^Œ��”
-            /// </summary>
-            InstDataCmount,
-            /// <summary>
-            /// ŒÙ—pŠJŽn“ú•t
-            /// </summary>
-            HireStartDays,
-            /// <summary>
-            /// ŒÙ—p�I—¹“ú•t
-            /// </summary>
-            HireCompDays,
-        }
-        #endregion
-
-        #region •”��“à‚Ì’S“–ŽÒƒR�[ƒh‚ðˆê——‚Å•Ô‚·
-        /// <summary>
-        /// •”��“à‚Ì’S“–ŽÒƒR�[ƒh‚ðˆê——‚Å•Ô‚·
-        /// </summary>
-        /// <param name="DepartmentCode">•”��ƒR�[ƒh</param>
-        /// <param name="PersonCodeList">’S“–ŽÒƒR�[ƒhˆê——</param>
-        /// <returns>ƒf�[ƒ^Œ��”</returns>
-        private int GetPersonInDepartment(ref List<int> PersonCodeList, ref List<DateTime> dtStartList,
-                                            ref List<DateTime> dtCompList, ref List<DateTime> dtMaxComp,
-                                            ref List<int> MonthSalaryList, ref List<DateTime> dtHireStDays, ref List<DateTime> dtHireEdDays)
-        {
-            IOMPersonInCharge PersonDB = new IOMPersonInCharge();
-            try
-            {
-                int DepartmentCode = GetDepartmentCode();
-                int PersonCode = CommonMotions.cnvInt(cmbConstructionPerson.SelectedValue);
-                int NotOrder = CommonDefine.ProjectsStatus.First(x => x.Value.Equals("”ñ Žó ’�")).Key;
-
-                StringBuilder strSQL = new StringBuilder();
-                strSQL.Append("SELECT P.PERSONCODE, P.PERSONNAME, P.DISPLAYORDER, P.MonthlySalary,");
-                strSQL.Append(" MIN(C.CONSTRUCTIONPERIODSTART) M1, MIN(C.CONSTRUCTIONPERIODSTART2) M2,");
-                strSQL.Append(" MIN(D.CONSTRUCTIONPERIODSTART) S1, MIN(D.CONSTRUCTIONPERIODSTART2) S2,");
-                strSQL.Append(" MIN(E.CONSTRUCTIONPERIODSTART) I1, MIN(E.CONSTRUCTIONPERIODSTART2) I2,");
-                strSQL.Append(" MAX(C.CONSTRUCTIONPERIODEND) M3, MAX(C.CONSTRUCTIONPERIODEND2) M4,");
-                strSQL.Append(" MAX(D.CONSTRUCTIONPERIODEND) S3, MAX(D.CONSTRUCTIONPERIODEND2) S4,");
-                strSQL.Append(" MAX(E.CONSTRUCTIONPERIODEND) I3, MAX(E.CONSTRUCTIONPERIODEND2) I4,");
-                strSQL.Append(" SUM(C.EXECUTIONAMOUNT) M5, SUM(D.EXECUTIONAMOUNT) S5, SUM(E.EXECUTIONAMOUNT) I5,");
-                strSQL.Append(" COUNT(C.EXECUTIONAMOUNT) M6, COUNT(D.EXECUTIONAMOUNT) S6, COUNT(E.EXECUTIONAMOUNT) I6,");
-                strSQL.Append(" P.STARTDATE, P.ENDDATE");
-                strSQL.Append(" FROM PERSONINCHARGEMASTER P");
-
-                // �HŽ–’S“–ŽÒ‚Ìƒf�[ƒ^Žæ“¾
-                strSQL.Append(" LEFT JOIN (SELECT C1.CONSTRUCTIONPERSONCODE, C1.CONSTRUCTIONSTATUSFLG, C1.CONSTRUCTIONPERIOD");
-                strSQL.Append(", C1.CONSTRUCTIONPERIODSTART, C1.CONSTRUCTIONPERIODSTART2, C1.CONSTRUCTIONPERIODEND, C1.CONSTRUCTIONPERIODEND2, C2.EXECUTIONAMOUNT");
-                strSQL.Append(" FROM CONSTRUCTIONBASEINFO C1, CONSTRUCTIONLEDGERDETAIL C2, CONSTRUCTIONLEDGER C3");
-                strSQL.Append(" WHERE C2.CONSTRUCTIONCODE = C1.CONSTRUCTIONCODE");
-                strSQL.AppendFormat(" AND C2.GROUPCOUNT = {0}", (int)FrmConstructionLedger.DataGroup.Payroll);
-                strSQL.Append(" AND C3.CONSTRUCTIONCODE = C2.CONSTRUCTIONCODE) C");
-                strSQL.Append(" ON C.CONSTRUCTIONPERSONCODE = P.PERSONCODE");
-                strSQL.AppendFormat(" AND C.CONSTRUCTIONSTATUSFLG <> {0}", NotOrder);
-                strSQL.AppendFormat(" AND C.CONSTRUCTIONPERIOD = {0}", numUDConstPro.Value);
-
-                // �HŽ–•›’S“–ŽÒ‚Ìƒf�[ƒ^Žæ“¾
-                strSQL.Append(" LEFT JOIN (SELECT D1.CONSTRSUBPERSONCODE CONSTRUCTIONPERSONCODE, D1.CONSTRUCTIONSTATUSFLG, D1.CONSTRUCTIONPERIOD");
-                strSQL.Append(", D1.CONSTRUCTIONPERIODSTART, D1.CONSTRUCTIONPERIODSTART2, D1.CONSTRUCTIONPERIODEND, D1.CONSTRUCTIONPERIODEND2, D2.EXECUTIONAMOUNT");
-                strSQL.Append(" FROM CONSTRUCTIONBASEINFO D1, CONSTRUCTIONLEDGERDETAIL D2, CONSTRUCTIONLEDGER D3");
-                strSQL.Append(" WHERE D2.CONSTRUCTIONCODE = D1.CONSTRUCTIONCODE");
-                strSQL.AppendFormat(" AND D2.GROUPCOUNT = {0}", (int)FrmConstructionLedger.DataGroup.Assistant);
-                strSQL.Append(" AND D3.CONSTRUCTIONCODE = D2.CONSTRUCTIONCODE) D");
-                strSQL.Append(" ON D.CONSTRUCTIONPERSONCODE = P.PERSONCODE");
-                strSQL.AppendFormat(" AND D.CONSTRUCTIONSTATUSFLG <> {0}", NotOrder);
-                strSQL.AppendFormat(" AND D.CONSTRUCTIONPERIOD = {0}", numUDConstPro.Value);
-
-                // �HŽ–Žw“±ˆõ‚Ìƒf�[ƒ^Žæ“¾
-                strSQL.Append(" LEFT JOIN (SELECT E1.CONSTRUCTIONINSTRUCTOR CONSTRUCTIONPERSONCODE, E1.CONSTRUCTIONSTATUSFLG, E1.CONSTRUCTIONPERIOD");
-                strSQL.Append(", E1.CONSTRUCTIONPERIODSTART, E1.CONSTRUCTIONPERIODSTART2, E1.CONSTRUCTIONPERIODEND, E1.CONSTRUCTIONPERIODEND2, E2.EXECUTIONAMOUNT");
-                strSQL.Append(" FROM CONSTRUCTIONBASEINFO E1, CONSTRUCTIONLEDGERDETAIL E2, CONSTRUCTIONLEDGER E3");
-                strSQL.Append(" WHERE E2.CONSTRUCTIONCODE = E1.CONSTRUCTIONCODE");
-                strSQL.AppendFormat(" AND E2.GROUPCOUNT = {0}", (int)FrmConstructionLedger.DataGroup.Instructor);
-                strSQL.Append(" AND E3.CONSTRUCTIONCODE = E2.CONSTRUCTIONCODE) E");
-                strSQL.Append(" ON E.CONSTRUCTIONPERSONCODE = P.PERSONCODE");
-                strSQL.AppendFormat(" AND E.CONSTRUCTIONSTATUSFLG <> {0}", NotOrder);
-                strSQL.AppendFormat(" AND E.CONSTRUCTIONPERIOD = {0}", numUDConstPro.Value);
-
-                strSQL.AppendFormat(" WHERE P.LEDGERFLG = {0}", (int)CommonDefine.PersonLedgerDivNo.CalcTarget);
-
-                // “–ŠúŠúŽñ“ú�EŠú––“ú‚ðŽæ“¾
-                DateTime dtDefaultStart = DateTime.MinValue;
-                DateTime dtDefaultEnd = DateTime.MinValue;
-                CreateDefaultStartAndEndDate(ref dtDefaultStart, ref dtDefaultEnd);
-                strSQL.AppendFormat(" AND (DATE(P.STARTDATE) <= STR_TO_DATE('{0}','%Y/%m/%d')", dtDefaultEnd.ToShortDateString());
-                strSQL.AppendFormat(" AND (STR_TO_DATE('{0}','%Y/%m/%d') <= DATE(P.ENDDATE)", dtDefaultStart.ToShortDateString());
-                strSQL.AppendFormat(" OR STR_TO_DATE('{0}','%Y/%m/%d') = DATE(P.ENDDATE)))", DateTime.MinValue.ToShortDateString());
-                if (CommonMotions.LoginUserData.PersonCode != CommonDefine.AdminCode)
-                {
-                    strSQL.Append(" AND P.DEPARTMENTCODE IN (select PDep.DepartmentCode from PersonDepartmentMaster AS PDep");
-                    strSQL.AppendFormat(" WHERE PDep.PersonCode = {0})", CommonMotions.LoginUserData.PersonCode);
-                }
-
-                // �HŽ–‘ä’ ƒf�[ƒ^‚Ì•”��‚¾‚¯‚ª‘Î�Û
-                if (DepartmentCode == 0)
-                {
-                    strSQL.Append(" AND P.DEPARTMENTCODE IN");
-                    strSQL.Append(" (SELECT TMP.DEPARTMENTCODE FROM (SELECT A.DEPARTMENTCODE, A.DEPARTMENTSTRING, A.DISPLAYORDER, COUNT(*) CNT");
-                    strSQL.Append(" FROM DEPARTMENTMASTER A, PERSONINCHARGEMASTER B, CONSTRUCTIONBASEINFO C , CONSTRUCTIONLEDGERDETAIL D");
-                    strSQL.Append(" WHERE A.DELETEFLG = 0");
-                    strSQL.Append(" AND A.DEPARTMENTCODE = B.DEPARTMENTCODE");
-                    strSQL.Append(" AND B.PERSONCODE = C.CONSTRUCTIONPERSONCODE");
-                    strSQL.Append(" AND D.CONSTRUCTIONCODE = C.CONSTRUCTIONCODE");
-
-                    strSQL.Append(" GROUP BY A.DEPARTMENTCODE, A.DEPARTMENTSTRING, A.DISPLAYORDER) TMP)");
-                }
-                else
-                {
-                    // •”��ƒR�[ƒh‘I‘ðŽž‚Í•”��‚ðŒŸ�õ�ðŒ�‚Ö“ü‚ê‚é
-                    strSQL.AppendFormat(" AND P.DEPARTMENTCODE = {0}", DepartmentCode);
-                }
-                if (PersonCode != 0) strSQL.AppendFormat(" AND P.PERSONCODE = {0}", PersonCode);
-
-                strSQL.Append(" GROUP BY P.PERSONCODE, P.PERSONNAME, P.DISPLAYORDER, P.MonthlySalary, P.STARTDATE, P.ENDDATE");
-                strSQL.Append(" ORDER BY P.DISPLAYORDER");
-
-                ArrayList arList = new ArrayList();
-                if (!PersonDB.ExecuteReader(strSQL.ToString(), ref arList)) return 0;
-
-                DateTime stDate = DateTime.MaxValue;
-                DateTime edDate = DateTime.MinValue;
-                DateTime maxDate = DateTime.MinValue;
-                foreach (object[] objRec in arList)
-                {
-                    stDate = DateTime.MaxValue;
-                    edDate = DateTime.MinValue;
-                    maxDate = DateTime.MinValue;
-
-                    // ’S“–ŽÒƒR�[ƒh‚ðŽæ“¾‚·‚é
-                    int Person = CommonMotions.cnvInt(objRec[(int)GetPersonTerm.Personcode]);
-
-                    DateTime wrkDate = DateTime.MinValue;
-                    // �Å�¬‚ÌŠJŽn“ú‚ðŽæ“¾‚·‚é
-                    //stDate = dtDefaultStart;
-                    wrkDate = CommonMotions.cnvDate(objRec[(int)GetPersonTerm.MainStart1]).Date;
-                    if (wrkDate != DateTime.MinValue && wrkDate < stDate) stDate = wrkDate;
-                    wrkDate = CommonMotions.cnvDate(objRec[(int)GetPersonTerm.MainStart2]).Date;
-                    if (wrkDate != DateTime.MinValue && wrkDate < stDate) stDate = wrkDate;
-
-                    // �Å‘å‚Ì�I—¹“ú‚ðŽæ“¾‚·‚é
-                    //maxDate = dtDefaultEnd;
-                    wrkDate = CommonMotions.cnvDate(objRec[(int)GetPersonTerm.MainEnd1]).Date;
-                    if (wrkDate != DateTime.MinValue && wrkDate > maxDate) maxDate = wrkDate;
-                    wrkDate = CommonMotions.cnvDate(objRec[(int)GetPersonTerm.MainEnd2]).Date;
-                    if (wrkDate != DateTime.MinValue && wrkDate > maxDate) maxDate = wrkDate;
-
-                    // ŒvŽZ‚Ì�I—¹“ú‚ðŽæ“¾‚·‚é
-                    //edDate = dtDefaultEnd;
-                    // ŒŽŠz‹‹—^‚ðŽæ“¾‚·‚é
-                    int Salary = CommonMotions.cnvInt(objRec[(int)GetPersonTerm.MonthlySalary]);
-
-                    // ŒÙ—pŠJŽn�E�I—¹“ú‚ðŽæ“¾‚·‚é
-                    DateTime dtHireStDay = CommonMotions.cnvDate(objRec[(int)GetPersonTerm.HireStartDays]);
-                    DateTime dtHireEdDay = CommonMotions.cnvDate(objRec[(int)GetPersonTerm.HireCompDays]);
-
-                    PersonCodeList.Add(Person);     // ’S“–ŽÒƒR�[ƒh
-                    dtStartList.Add(stDate);        // ŠJŽn“ú
-                    dtCompList.Add(edDate);         // �I—¹“ú
-                    dtMaxComp.Add(maxDate);         // �Å‘å�I—¹“ú
-                    MonthSalaryList.Add(Salary);    // ‹‹—^‹àŠz
-                    dtHireStDays.Add(dtHireStDay);  // ŒÙ—pŠJŽn“ú
-                    dtHireEdDays.Add(dtHireEdDay);  // ŒÙ—p�I—¹“ú
-                }
-                return arList.Count;
-            }
-            catch (Exception ex)
-            {
-                logger.ErrorFormat("ƒVƒXƒeƒ€ƒGƒ‰�[�F{0}�F{1}", CommonMotions.GetMethodName(), ex.Message);
-                return 0;
-            }
-            finally
-            {
-                PersonDB.close(); PersonDB = null;
-            }
-        }
-        #endregion
-
-        #region ’S“–ŽÒ–ˆ”ï–Ú–ˆ‚ÌŒo”ï‚ðŽæ“¾‚·‚é
-        /// <summary>
-        /// ’S“–ŽÒ–ˆ”ï–Ú–ˆ‚ÌŒo”ï‚ðŽæ“¾‚·‚é
-        /// </summary>
-        /// <param name="PersonCode">’S“–ŽÒƒR�[ƒh</param>
-        /// <param name="dtStart">ŠJŽn“ú•t</param>
-        /// <param name="dtEnd">�I—¹“ú•t</param>
-        /// <param name="CostValue">”ï–Ú–ˆŒo”ï</param>
-        private void GetPersonExpensesCostValue(int PersonCode, DateTime dtStart, DateTime dtEnd, ref int[] CostValue)
-        {
-            IOCostDataOfPerson CostDB = new IOCostDataOfPerson();
-            try
-            {
-                // ’S“–ŽÒ–ˆŒo”ïƒf�[ƒ^‚æ‚è‚Ç‚±‚Ì�HŽ–‚É‚à�Š‘®‚µ‚Ä‚¢‚È‚¢Œo”ï‚ðŽæ“¾‚·‚é
-                StringBuilder strSQL = new StringBuilder();
-                strSQL.Append("SELECT PERSONCODE, DATATYPE, SUM(ENTRYPRICE) FROM COSTDATAOFPERSON");
-                strSQL.AppendFormat(" WHERE PERSONCODE = {0}", PersonCode);
-                strSQL.AppendFormat(" AND ('{0}' <= DATE_FORMAT(ACTIONDATE,'%Y/%m/%d')", dtStart.ToShortDateString());
-                strSQL.AppendFormat(" AND DATE_FORMAT(ACTIONDATE,'%Y/%m/%d') <= '{0}')", dtEnd.ToShortDateString());
-                strSQL.Append(" AND CONSTRUCTIONCODE = 0");
-                strSQL.Append(" GROUP BY PERSONCODE, DATATYPE");
-                strSQL.Append(" ORDER BY PERSONCODE, DATATYPE");
-                ArrayList arList = new ArrayList();
-                if (!CostDB.ExecuteReader(strSQL.ToString(), ref arList)) return;
-
-                // Žæ“¾Œ‹‰Ê‚ð�U‚è•ª‚¯‚é
-                foreach (object[] wrkobj in arList)
-                {
-                    for (int i = 1; i < CommonDefine.CostDataNoString.Length; i++)
-                    {
-                        if (CommonMotions.cnvInt(wrkobj[1]) == i)
-                        {
-                            CostValue[i] += CommonMotions.cnvInt(wrkobj[2]);
-                            break;
-                        }
-                    }
-                }
-            }
-            catch (Exception ex)
-            {
-                logger.ErrorFormat("ƒVƒXƒeƒ€ƒGƒ‰�[�F{0}�F{1}", CommonMotions.GetMethodName(), ex.Message);
-            }
-            finally
-            {
-                CostDB.close(); CostDB = null;
-            }
-        }
-        #endregion
-
         #region ’S“–ŽÒ–ˆ‚Ì•â�•�U•ª‚ðŽæ“¾‚·‚é
         /// <summary>
         /// ’S“–ŽÒ–ˆ‚Ì•â�•�U•ª‚ðŽæ“¾‚·‚é
@@ -1064,9 +707,12 @@
                 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 = {0}", (int)FrmConstructionLedger.DataGroup.Instructor);
+                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 WHERE A1.DELETEFLG = 0");
+                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)
                 {
@@ -1076,31 +722,7 @@
 
                 if (DepartmentCode != 0) strSQL.AppendFormat(" AND A1.DEPARTMENTCODE = {0}", DepartmentCode);
                 if (PersonCode != 0) strSQL.AppendFormat(" AND A1.PERSONCODE = {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");
 
-                strSQL.Append(" UNION");
-                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 = {0}", (int)FrmConstructionLedger.DataGroup.Assistant);
-
-                strSQL.Append(" AND P.COMPANYCODE IN (SELECT A1.PERSONCODE FROM PERSONINCHARGEMASTER A1 WHERE A1.DELETEFLG = 0");
-
-                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);
-
                 strSQL.Append(" )");
                 strSQL.Append(" AND P.CONSTRUCTIONCODE = A.CONSTRUCTIONCODE");
                 strSQL.AppendFormat(" AND A.CONSTRUCTIONSTATUSFLG <> {0}", NotOrder);
@@ -1134,123 +756,6 @@
         }
         #endregion
 
-        #region �HŽ–�Ú�×‘ä’ ‚æ‚è�U•ª‹‹—^‹àŠz�E‘e—˜‰v‚ðŽæ“¾‚·‚é
-        /// <summary>
-        /// �HŽ–�Ú�×‘ä’ ‚æ‚è�U•ª‹‹—^‹àŠz�E‘e—˜‰v‚ðŽæ“¾‚·‚é
-        /// </summary>
-        /// <param name="OnSalary">�U•ª‹‹—^‹àŠz</param>
-        /// <param name="NetIncome">�ƒ—˜‰v‹àŠz</param>
-        /// <param name="NonSalary">‘e—˜‰v‹àŠz</param>
-        private void ProfitGeneral(ref int OnSalary, ref int NetIncome, ref int NonSalary)
-        {
-            IOConstructionLedger LedgerlDB = new IOConstructionLedger();
-            try
-            {
-                // •”��ƒR�[ƒhŽæ“¾
-                int DepartmentCode = GetDepartmentCode();
-                int PersonCode = CommonMotions.cnvInt(cmbConstructionPerson.SelectedValue);
-                int NotOrder = CommonDefine.ProjectsStatus.First(x => x.Value.Equals("”ñ Žó ’�")).Key;
-
-                // �U•ª‹‹—^‹àŠzŽæ“¾
-                StringBuilder strSQL = new StringBuilder();
-                strSQL.Append("SELECT SUM(C.EXECUTIONAMOUNT) FROM CONSTRUCTIONLEDGER P, CONSTRUCTIONBASEINFO B, CONSTRUCTIONLEDGERDETAIL C, PERSONINCHARGEMASTER D");
-                // �U•ª–³‚Å‚Í–³‚¢
-                strSQL.Append(" WHERE P.CONSTRUCTIONCODE IN (SELECT A.CONSTRUCTIONCODE FROM CONSTRUCTIONLEDGERDETAIL A");
-                strSQL.AppendFormat(" WHERE A.GROUPCOUNT = {0} AND (A.SALARYFLG = {1} OR A.SALARYFLG = {2}))"
-                                        , (int)FrmConstructionLedger.DataGroup.Payroll
-                                        , (int)CommonDefine.SalaryDevision.All
-                                        , (int)CommonDefine.SalaryDevision.DaysInput);
-
-                strSQL.Append(" AND P.CONSTRUCTIONCODE = B.CONSTRUCTIONCODE");
-                strSQL.AppendFormat(" AND B.CONSTRUCTIONPERIOD = {0}", numUDConstPro.Value);
-                strSQL.AppendFormat(" AND B.CONSTRUCTIONSTATUSFLG != {0}", NotOrder);
-                strSQL.Append(" AND C.CONSTRUCTIONCODE = P.CONSTRUCTIONCODE");
-                strSQL.AppendFormat(" AND C.GROUPCOUNT = {0}", (int)FrmConstructionLedger.DataGroup.Payroll);
-                strSQL.Append(" AND D.PERSONCODE = B.CONSTRUCTIONPERSONCODE");
-
-                if (CommonMotions.LoginUserData.PersonCode != CommonDefine.AdminCode)
-                {
-                    strSQL.Append(" AND D.DEPARTMENTCODE IN (select PDep.DepartmentCode from PersonDepartmentMaster AS PDep");
-                    strSQL.AppendFormat(" WHERE PDep.PersonCode = {0})", CommonMotions.LoginUserData.PersonCode);
-                }
-
-                if (DepartmentCode != 0) strSQL.AppendFormat(" AND D.DEPARTMENTCODE = {0}", DepartmentCode);
-                if (PersonCode != 0) strSQL.AppendFormat(" AND D.PERSONCODE = {0}", PersonCode);
-
-                ArrayList arList = new ArrayList();
-                if (!LedgerlDB.ExecuteReader(strSQL.ToString(), ref arList)) return;
-                object[] objSalary = (object[])arList[0];
-                OnSalary = CommonMotions.cnvInt(objSalary[0]);
-
-                // �U•ª�Ï‚Ý•ª�ƒ—˜‰vŽæ“¾
-                strSQL.Clear();
-                strSQL.Append("SELECT SUM(P.NETPROFIT) FROM CONSTRUCTIONLEDGER P, CONSTRUCTIONBASEINFO B, PERSONINCHARGEMASTER D");
-                // �U•ª�Ï‚Ý•ª�ƒ—˜‰v
-                strSQL.Append(" WHERE P.CONSTRUCTIONCODE IN (SELECT A.CONSTRUCTIONCODE  FROM CONSTRUCTIONLEDGERDETAIL A");
-                strSQL.AppendFormat(" WHERE A.GROUPCOUNT = {0} AND (A.SALARYFLG = {1} OR A.SALARYFLG = {2}))"
-                                        , (int)FrmConstructionLedger.DataGroup.Payroll
-                                        , (int)CommonDefine.SalaryDevision.All
-                                        , (int)CommonDefine.SalaryDevision.DaysInput);
-
-                strSQL.Append(" AND P.CONSTRUCTIONCODE = B.CONSTRUCTIONCODE");
-                strSQL.AppendFormat(" AND B.CONSTRUCTIONPERIOD = {0}", numUDConstPro.Value);
-                strSQL.AppendFormat(" AND B.CONSTRUCTIONSTATUSFLG != {0}", NotOrder);
-                strSQL.Append(" AND D.PERSONCODE = B.CONSTRUCTIONPERSONCODE");
-                
-                if (CommonMotions.LoginUserData.PersonCode != CommonDefine.AdminCode)
-                {
-                    strSQL.Append(" AND D.DEPARTMENTCODE IN (select PDep.DepartmentCode from PersonDepartmentMaster AS PDep");
-                    strSQL.AppendFormat(" WHERE PDep.PersonCode = {0})", CommonMotions.LoginUserData.PersonCode);
-                }
-
-                if (DepartmentCode != 0) strSQL.AppendFormat(" AND D.DEPARTMENTCODE = {0}", DepartmentCode);
-                if (PersonCode != 0) strSQL.AppendFormat(" AND D.PERSONCODE = {0}", PersonCode);
-
-                ArrayList arList2 = new ArrayList();
-                if (!LedgerlDB.ExecuteReader(strSQL.ToString(), ref arList2)) return;
-                object[] objNetIncome = (object[])arList2[0];
-                NetIncome = CommonMotions.cnvInt(objNetIncome[0]);
-
-                // �U•ª–³‚µ•ª�ƒ—˜‰vŽæ“¾
-                strSQL.Clear();
-                strSQL.Append("SELECT SUM(P.NETPROFIT) FROM CONSTRUCTIONLEDGER P, CONSTRUCTIONBASEINFO B, PERSONINCHARGEMASTER D");
-                // �U•ª�Ï‚Ý•ª�ƒ—˜‰v
-                strSQL.Append(" WHERE P.CONSTRUCTIONCODE NOT IN (SELECT A.CONSTRUCTIONCODE  FROM CONSTRUCTIONLEDGERDETAIL A");
-                strSQL.AppendFormat(" WHERE A.GROUPCOUNT = {0} AND (A.SALARYFLG = {1} OR A.SALARYFLG = {2}))"
-                                        , (int)FrmConstructionLedger.DataGroup.Payroll
-                                        , (int)CommonDefine.SalaryDevision.All
-                                        , (int)CommonDefine.SalaryDevision.DaysInput);
-
-                strSQL.Append(" AND P.CONSTRUCTIONCODE = B.CONSTRUCTIONCODE");
-                strSQL.AppendFormat(" AND B.CONSTRUCTIONPERIOD = {0}", numUDConstPro.Value);
-                strSQL.AppendFormat(" AND B.CONSTRUCTIONSTATUSFLG != {0}", NotOrder);
-                strSQL.Append(" AND D.PERSONCODE = B.CONSTRUCTIONPERSONCODE");
-
-                if (CommonMotions.LoginUserData.PersonCode != CommonDefine.AdminCode)
-                {
-                    strSQL.Append(" AND D.DEPARTMENTCODE IN (select PDep.DepartmentCode from PersonDepartmentMaster AS PDep");
-                    strSQL.AppendFormat(" WHERE PDep.PersonCode = {0})", CommonMotions.LoginUserData.PersonCode);
-                }
-
-                if (DepartmentCode != 0) strSQL.AppendFormat(" AND D.DEPARTMENTCODE = {0}", DepartmentCode);
-                if (PersonCode != 0) strSQL.AppendFormat(" AND D.PERSONCODE = {0}", PersonCode);
-
-                ArrayList arList3 = new ArrayList();
-                if (!LedgerlDB.ExecuteReader(strSQL.ToString(), ref arList3)) return;
-                object[] objNonSalary = (object[])arList3[0];
-                NonSalary = CommonMotions.cnvInt(objNonSalary[0]);
-            }
-            catch (Exception ex)
-            {
-                logger.ErrorFormat("ƒVƒXƒeƒ€ƒGƒ‰�[�F{0}�F{1}", CommonMotions.GetMethodName(), ex.Message);
-            }
-            finally
-            {
-                LedgerlDB.close(); LedgerlDB = null;
-            }
-        }
-        #endregion
-
         #region ˆê——ƒf�[ƒ^•\Ž¦�ˆ—�
         /// <summary>
         /// ˆê——ƒf�[ƒ^•\Ž¦�ˆ—�
@@ -1259,6 +764,7 @@
         {
             IOConstructionLedger LedgerDB = new IOConstructionLedger();
             IOMPersonInCharge SalaryDB = new IOMPersonInCharge();
+            IOCostDataOfPerson CostDB = new IOCostDataOfPerson();
             DataGridView dgv = dgvMaster;
             ProgressBar prgber = ProgressBar;
             try
@@ -1282,7 +788,6 @@
 
                 // “Ç�žŽžƒf�[ƒ^ƒJƒEƒ“ƒgŽæ“¾
                 m_initDataCount = arData.Count;
-                //if (arData.Count == 0) return;
 
                 // ProgressBar‚Ì’l‚ð•Ï�X‚·‚é
                 prgber.Value++;
@@ -1403,17 +908,11 @@
                 prgber.Update();
 
                 // ----- ’S“–ŽÒ–ˆ‚ÌŽw’èŠú‚ÌŠJŽn�E�I—¹”NŒŽ“ú‚ðŽæ“¾‚·‚é
-                List<int> PersonCDArray = new List<int>();
-                List<DateTime> dtStartArray = new List<DateTime>();
-                List<DateTime> dtCompArray = new List<DateTime>();
-                List<DateTime> dtMaxCompArray = new List<DateTime>();
-                List<int> SalaryArray = new List<int>();
-                List<DateTime> dtHireStDays = new List<DateTime>();
-                List<DateTime> dtHireEdDays = new List<DateTime>();
-                GetPersonInDepartment(ref PersonCDArray,
-                                        ref dtStartArray, ref dtCompArray,
-                                        ref dtMaxCompArray, ref SalaryArray,
-                                        ref dtHireStDays, ref dtHireEdDays);
+                ArrayList TargetList = new ArrayList();
+                CreateLedgerSQL.GetPersonInDepartment((int)numUDConstPro.Value,
+                                                    GetDepartmentCode(),
+                                                    CommonMotions.cnvInt(cmbConstructionPerson.SelectedValue),
+                                                    ref TargetList);
 
                 // ProgressBar‚Ì’l‚ð•Ï�X‚·‚é
                 prgber.Value++;
@@ -1422,16 +921,13 @@
                 // ƒfƒtƒHƒ‹ƒgŠJŽn�E�I—¹‚ðŽæ“¾‚·‚é
                 DateTime dtDefaultStart = DateTime.MinValue;
                 DateTime dtDefaultEnd = DateTime.MinValue;
-                CreateDefaultStartAndEndDate(ref dtDefaultStart, ref dtDefaultEnd);
+                CreateLedgerSQL.CreateDefaultStartAndEndDate((int)numUDConstPro.Value, ref dtDefaultStart, ref dtDefaultEnd);
 
                 // ----- Œo‰ß‹‹—^•\Ž¦�iƒwƒbƒ_�[‚É•\Ž¦�j
-                SetPayrollData(PersonCDArray, dtDefaultStart, dtDefaultEnd,
-                                dtStartArray, dtCompArray,
-                                SalaryArray, dtMaxCompArray,
-                                dtHireStDays, dtHireEdDays, SalaryDB);
+                SetPayrollData(TargetList, dtDefaultStart, dtDefaultEnd, SalaryDB, LedgerDB);
 
                 // ----- Œo”ï‚ð•\Ž¦‚·‚é
-                int Expenses = SetOtherCost(PersonCDArray, dtStartArray, dtCompArray, dtHireStDays);
+                int Expenses = SetOtherCost(dtDefaultStart, dtDefaultEnd, TargetList, CostDB);
 
                 // ProgressBar‚Ì’l‚ð•Ï�X‚·‚é
                 prgber.Value++;
@@ -1470,10 +966,7 @@
                     dgv.Rows[AllTotalRow].Cells[i].Value = TotalArea[i].ToString("#,0");
                 }
 
-                // ----- �ÅŒã‚ÉŒo”ï‚ª‚ ‚ê‚Î�ÄŒvŽZ
-                //ReCalcHeader(Expenses);
 
-
                 // ProgressBar‚Ì’l‚ð•Ï�X‚·‚é
                 prgber.Value = prgber.Maximum;
                 prgber.Update();
@@ -1498,6 +991,7 @@
 
                 LedgerDB.close(); LedgerDB = null;
                 SalaryDB.close(); SalaryDB = null;
+                CostDB.close(); CostDB = null;
                 dgv.ResumeLayout();
 
                 // ProgressBar‚Ì’l‚ð•Ï�X‚·‚é
@@ -1670,53 +1164,6 @@
         }
         #endregion
 
-        #region ŒvŽZŠJŽn�E�I—¹“ú‚Ìƒ`ƒFƒbƒN“ü‚ê‘Ö‚¦
-        /// <summary>
-        /// ŒvŽZŠJŽn�E�I—¹“ú‚Ìƒ`ƒFƒbƒN“ü‚ê‘Ö‚¦
-        /// </summary>
-        private void CalcStartCompDate(DateTime dtDefaultStart, DateTime dtDefaultEnd,
-                                        DateTime HireStartDate, DateTime HireCompDate,
-                                        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;
-                }
-
-                // �Å‘å“ú‚ª�¡“ú‚æ‚è�¬‚³‚¢�ê�‡ˆÈŠO‚Í�ˆ—�‚µ‚È‚¢
-                if (CompDate.Date > DateTime.Today.Date) return;
-
-                if (numUDConstPro.Value != CommonMotions.SystemMasterData.BusinessPeriod)
-                {   // �¡ŠúˆÈŠO‚Í‚ÍŠú––
-                    CompDate = dtDefaultEnd;
-                }
-                else if (HireCompDate != DateTime.MinValue
-                        && (dtDefaultStart < HireCompDate && HireCompDate < dtDefaultEnd))
-                {   // ‘ÞŽÐ“ú‚ªŠú“à‚È‚ç‚Î�I—¹‚ð‘ÞŽÐ“ú‚É‚·‚é
-                    CompDate = HireCompDate;
-                }
-                else
-                {   // ˆÈŠO‚Í�¡“ú
-                    CompDate = DateTime.Today.Date;
-                }
-            }
-            catch (Exception ex)
-            {
-                logger.ErrorFormat("ƒVƒXƒeƒ€ƒGƒ‰�[�F{0}", ex.Message);
-            }
-        }
-        #endregion
-
         #region ŠúŠJŽn‘Oƒwƒbƒ_�[ƒNƒŠƒA
         /// <summary>
         /// ŠúŠJŽn‘Oƒwƒbƒ_�[ƒNƒŠƒA
@@ -1763,15 +1210,9 @@
         /// <summary>
         /// �¡Šú‚ÌŒo‰ß‹‹—^‚ð•\Ž¦‚·‚é
         /// </summary>
-        /// <param name="PersonCDArray"></param>
-        /// <param name="dtStartArray"></param>
-        /// <param name="dtCompArray"></param>
-        /// <param name="SalaryArray"></param>
-        private void SetPayrollData(List<int> PersonCDArray, DateTime dtDefaultStart, DateTime dtDefaultEnd,
-                                    List<DateTime> dtStartArray, List<DateTime> dtCompArray,
-                                    List<int> SalaryArray, List<DateTime> dtMaxCompArray,
-                                    List<DateTime> dtHireStDayArray, List<DateTime> dtHireEdDayArray,
-                                    IOMPersonInCharge SalaryDB)
+        private void SetPayrollData(ArrayList TargetList,
+                                    DateTime dtDefaultStart, DateTime dtDefaultEnd,
+                                    IOMPersonInCharge SalaryDB, IOConstructionLedger LedgerDB)
         {
             try
             {
@@ -1781,9 +1222,8 @@
 
                 int TotalSalary = 0;        // ‹‹—^—Ý�ÏŽæ“¾
                 int OnSalary = 0;           // �U•ª‹‹—^‹àŠzŽæ“¾
-                int NetIncome = 0;          // �ƒ—˜‰v‹àŠzŽæ“¾
-                int NonSalary = 0;          // ‘e—˜‰v‹àŠzŽæ“¾
 
+                int PersonCode = 0;
                 DateTime stDate = DateTime.Today;
                 DateTime edDate = DateTime.Today;
                 DateTime DspSTDate = DateTime.MaxValue;
@@ -1790,17 +1230,28 @@
                 DateTime DspEdDate = DateTime.MinValue;
 
                 // ‹‹—^‚ð�WŒv‚·‚é
-                for (int i = 0; i < PersonCDArray.Count; i++)
+                foreach (object[] ObjRec in TargetList)
                 {
                     // ŠJŽn�E�I—¹“ú‚ª–³‚¢�ê�‡‚ÍƒfƒtƒHƒ‹ƒg‚ÌŠúŽñ�EŠú––‚ðŽg—p‚·‚é
-                    stDate = dtStartArray[i];
-                    edDate = dtMaxCompArray[i];
-                    CalcStartCompDate(dtDefaultStart, dtDefaultEnd, dtHireStDayArray[i], dtHireEdDayArray[i], ref stDate, ref edDate);
+                    stDate = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.StartDate]);
+                    edDate = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.CompDate]);
+                    CreateLedgerSQL.CalcStartCompDate((int)numUDConstPro.Value,
+                                        dtDefaultStart, dtDefaultEnd,
+                                        CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.HireStartDays]),
+                                        CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.HireCompDays]),
+                                        ref stDate, ref edDate);
 
+                    PersonCode = CommonMotions.cnvInt(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.PersonCode]);
                     // ‹‹—^—Ý�ÏŽæ“¾
-                    int workSalary = CommonMotions.CalcElapsedSalary(SalaryDB, stDate, edDate, PersonCDArray[i]);
+                    int workSalary = CommonMotions.CalcElapsedSalary(SalaryDB, stDate, edDate, PersonCode);
                     // —ÝŒv‰ÁŽZ
                     TotalSalary += workSalary;
+
+                    // ’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);
+                    OnSalary += wrkSalary;
+
                     // •\Ž¦“ú•tŽæ“¾
                     if (DspSTDate > stDate) DspSTDate = stDate;
                     if (DspEdDate < edDate) DspEdDate = edDate;
@@ -1807,9 +1258,6 @@
                 }
 
                 // ----- •\Ž¦�ˆ—�
-                // �U•ª‹‹—^‹àŠz�E�ƒ—˜‰v‹àŠz�E‘e—˜‰v‹àŠzŽæ“¾
-                ProfitGeneral(ref OnSalary, ref  NetIncome, ref  NonSalary);
-
                 // �U•ª‹‹—^‹àŠz•\Ž¦
                 lblCalcValue1.Text = OnSalary.ToString("#,0");
 
@@ -2055,7 +1503,7 @@
                 // “–ŠúŠúŽñ“ú�EŠú––“ú‚ðŽæ“¾
                 DateTime dtDefaultStart = DateTime.MinValue;
                 DateTime dtDefaultEnd = DateTime.MinValue;
-                CreateDefaultStartAndEndDate(ref dtDefaultStart, ref dtDefaultEnd);
+                CreateLedgerSQL.CreateDefaultStartAndEndDate((int)numUDConstPro.Value, ref dtDefaultStart, ref dtDefaultEnd);
 
                 strSQL.AppendFormat(" AND (DATE(STARTDATE) <= STR_TO_DATE('{0}','%Y/%m/%d')", dtDefaultEnd.ToShortDateString());
                 strSQL.AppendFormat(" AND (STR_TO_DATE('{0}','%Y/%m/%d') <= DATE(ENDDATE)", dtDefaultStart.ToShortDateString());
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/CostomerRegist/FrmCostomerRegistAuxiliary.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/CostomerRegist/FrmCostomerRegistAuxiliary.cs	(revision 260)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/CostomerRegist/FrmCostomerRegistAuxiliary.cs	(revision 261)
@@ -681,7 +681,7 @@
 
                 List<DivisionMaster> bvList = new List<DivisionMaster>();
                 // Valueã�‹ã‚‰Keyã‚’æ¤œç´¢
-                int DivisionCode = (int)CommonDefine.DivisionMasterCodeDefine.OrderDivision;
+                int DivisionCode = (int)DivisionMaster.DivisionMasterCodeDefine.OrderDivision;
                 string strSQL = dvDB.CreatePrimarykeyString(DivisionCode) + " And DeleteFlg = 0 ORDER BY DISPLAYORDER";
                 if (!dvDB.SelectAction(strSQL, ref bvList)) return;
                 if (bvList.Count == 0) return;
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/DepExpenssList/FrmDepExpenssListAuxiliary.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/DepExpenssList/FrmDepExpenssListAuxiliary.cs	(revision 260)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/DepExpenssList/FrmDepExpenssListAuxiliary.cs	(revision 261)
@@ -232,11 +232,9 @@
         /// ƒOƒŠƒbƒh�sƒf�[ƒ^ƒZƒbƒg
         /// </summary>
         private void GridDataSet(object[] objwrk, ref int ino, ref int[] TotalArea,
-                                    List<int> DepInPerArray, List<int> PersonCDArray,
-                                    List<DateTime> dtStartArray, List<DateTime> dtCompArray, List<int> SalaryArray,
-                                    List<DateTime> dtHireStDayArray, List<DateTime> dtHireEdDayArray,
+                                    ArrayList TargetList,
                                     DateTime dtDefaultStart, DateTime dtDefaultEnd,
-                                    IOMPersonInCharge SalaryDB)
+                                    IOMPersonInCharge SalaryDB, IOConstructionLedger LedgerDB, IOCostDataOfPerson CostDB)
         {
             try
             {
@@ -271,30 +269,34 @@
                 int[] CostValue2 = new int[ArrayCount];
                 int TotalSalary = 0;
                 int OnSalary = 0;
-                int NetIncome = 0;
-                int NonSalary = 0;
+                DateTime stDate = DateTime.MaxValue;
+                DateTime edDate = DateTime.MinValue;
 
                 if (PersonCode == 0)
                 {
-                    for (int i = 0; i < PersonCDArray.Count; i++)
+                    int CurPersonCode = 0;
+                    foreach (object[] ObjRec in TargetList)
                     {
-                        if (DepInPerArray[i] != DepartmentCode) continue;
+                        if (CommonMotions.cnvInt(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.DepartmentCode]) != DepartmentCode) continue;
+
                         // ŠJŽn�E�I—¹“ú‚ª–³‚¢�ê�‡‚ÍƒfƒtƒHƒ‹ƒg‚ÌŠúŽñ�EŠú––‚ðŽg—p‚·‚é
-                        DateTime stDate = dtStartArray[i];
-                        DateTime edDate = dtCompArray[i];
-                        CalcStartCompDate(dtDefaultStart, dtDefaultEnd, dtHireStDayArray[i], dtHireEdDayArray[i], ref stDate, ref edDate);
+                        stDate = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.StartDate]);
+                        edDate = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.CompDate]);
+                        CreateLedgerSQL.CalcStartCompDate((int)numUDConstPro.Value,
+                                        dtDefaultStart, dtDefaultEnd,
+                                        CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.HireStartDays]),
+                                        CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.HireCompDays]),
+                                            ref stDate, ref edDate);
 
-                        dtStartArray[i] = stDate;
-                        dtCompArray[i] = edDate;
-
+                        CurPersonCode = CommonMotions.cnvInt(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.PersonCode]);
                         // Œo”ïŽæ“¾
-                        GetPersonExpensesCostValue(PersonCDArray[i], dtStartArray[i], dtCompArray[i], ref CostValue2);
+                        CreateLedgerSQL.GetPersonExpensesCostValue(CostDB, 0, CurPersonCode, dtDefaultStart, dtDefaultEnd, ref CostValue2);
 
                         // ‹‹—^—Ý�ÏŽæ“¾
                         int workSalary = 0;
                         if (numUDConstPro.Value <= CommonMotions.SystemMasterData.BusinessPeriod)
                         {
-                            workSalary = CommonMotions.CalcElapsedSalary(SalaryDB, dtStartArray[i], dtCompArray[i], PersonCDArray[i]);
+                            workSalary = CommonMotions.CalcElapsedSalary(SalaryDB, stDate, edDate, CurPersonCode);
                         }
                         // —ÝŒv‰ÁŽZ
                         TotalSalary += workSalary;
@@ -301,51 +303,50 @@
                     }
 
                     // �U•ª‹‹—^‹àŠz�E�ƒ—˜‰v‹àŠz�E‘e—˜‰v‹àŠzŽæ“¾
-                    ProfitGeneral(DepartmentCode, PersonCode, ref OnSalary, ref  NetIncome, ref  NonSalary);
+                    CreateLedgerSQL.ProfitGeneral(LedgerDB, (int)numUDConstPro.Value, DepartmentCode, 0, ref OnSalary);
                 }
                 else
                 {
-                    int PersonCount = -1;
-                    for (int i = 0; i < PersonCDArray.Count; i++)
+                    object[] ObjCur = null;
+                    foreach (object[] ObjRec in TargetList)
                     {
                         // “¯‚¶’S“–ŽÒƒR�[ƒh‚ð’T‚·
-                        if (PersonCode == PersonCDArray[i])
+                        if (PersonCode == CommonMotions.cnvInt(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.PersonCode]))
                         {
-                            PersonCount = i;
+                            ObjCur = ObjRec;
                             break;
                         }
                     }
-                    if (PersonCount < 0) return;
+                    if (ObjCur == null) return;
 
                     // ŠJŽn�E�I—¹“ú‚ª–³‚¢�ê�‡‚ÍƒfƒtƒHƒ‹ƒg‚ÌŠúŽñ�EŠú––‚ðŽg—p‚·‚é
-                    DateTime stDate = dtStartArray[PersonCount];
-                    DateTime edDate = dtCompArray[PersonCount];
-                    CalcStartCompDate(dtDefaultStart, dtDefaultEnd, dtHireStDayArray[PersonCount], dtHireEdDayArray[PersonCount], ref stDate, ref edDate);
+                    stDate = CommonMotions.cnvDate(ObjCur[(int)CreateLedgerSQL.GetPersonTerm.StartDate]);
+                    edDate = CommonMotions.cnvDate(ObjCur[(int)CreateLedgerSQL.GetPersonTerm.CompDate]);
+                    CreateLedgerSQL.CalcStartCompDate((int)numUDConstPro.Value,
+                                        dtDefaultStart, dtDefaultEnd,
+                                        CommonMotions.cnvDate(ObjCur[(int)CreateLedgerSQL.GetPersonTerm.HireStartDays]),
+                                        CommonMotions.cnvDate(ObjCur[(int)CreateLedgerSQL.GetPersonTerm.HireCompDays]),
+                                        ref stDate, ref edDate);
 
-                    dtStartArray[PersonCount] = stDate;
-                    dtCompArray[PersonCount] = edDate;
-                    
                     // Œo”ïŽæ“¾
-                    GetPersonExpensesCostValue(PersonCDArray[PersonCount], dtStartArray[PersonCount], dtCompArray[PersonCount], ref CostValue2);
+                    CreateLedgerSQL.GetPersonExpensesCostValue(CostDB, 0, PersonCode, dtDefaultStart, dtDefaultEnd, ref CostValue2);
 
                     // ‹‹—^—Ý�ÏŽæ“¾
                     if (numUDConstPro.Value <= CommonMotions.SystemMasterData.BusinessPeriod)
                     {
-                        TotalSalary = CommonMotions.CalcElapsedSalary(SalaryDB, dtStartArray[PersonCount], dtCompArray[PersonCount], PersonCDArray[PersonCount]);
+                        TotalSalary = CommonMotions.CalcElapsedSalary(SalaryDB, stDate, edDate, PersonCode);
                     }
 
                     // �U•ª‹‹—^‹àŠz�E�ƒ—˜‰v‹àŠz�E‘e—˜‰v‹àŠzŽæ“¾
-                    ProfitGeneral(DepartmentCode, PersonCode, ref OnSalary, ref  NetIncome, ref  NonSalary);
+                    CreateLedgerSQL.ProfitGeneral(LedgerDB, (int)numUDConstPro.Value, DepartmentCode, PersonCode, ref OnSalary);
                 }
                 // ‰ÁŽZ
-                for (int i = 0; i < CostValue2.Length; i++)
-                {
-                    wrkArray[(int)DBGetData.TotalPayment] += CostValue2[i];         // ‘�Žx•¥Šz+�w“ü•i
-                    wrkArray[(int)DBGetData.GrossProfit] -= CostValue2[i];          // ‘e—˜‰v-�w“ü•i
-                    wrkArray[(int)DBGetData.NetProfit] -= CostValue2[i];            // �ƒ—˜‰v-�w“ü•i
-                }
+                wrkArray[(int)DBGetData.TotalPayment] += CostValue2.Sum();      // ‘�Žx•¥Šz+�w“ü•i
+                wrkArray[(int)DBGetData.GrossProfit] -= CostValue2.Sum();       // ‘e—˜‰v-�w“ü•i
+                wrkArray[(int)DBGetData.NetProfit] -= CostValue2.Sum();         // �ƒ—˜‰v-�w“ü•i
+
                 int TotalValue = OnSalary - TotalSalary;
-                wrkArray[(int)DBGetData.NetProfit] += TotalValue;                   // �ƒ—˜‰v+�U•ª‹‹—^�·Šz
+                wrkArray[(int)DBGetData.NetProfit] += TotalValue;               // �ƒ—˜‰v+�U•ª‹‹—^�·Šz
                 // ------------------------------------------------------------------------------------------
 
                 // ------ �U•ª‹‹—^‚ðŽæ“¾‚·‚é
@@ -354,11 +355,7 @@
                 // �U•ª‹àŠz‚ðŽæ“¾‚·‚é
                 GetPersonAuxiliaryCostValue(DepartmentCode, PersonCode, ref CostValue3);
                 // ‰ÁŽZ
-                for (int i = 0; i < CostValue3.Length; i++)
-                {
-                    //wrkArray[(int)DBGetData.GrossProfit] += CostValue3[i];          // ‘e—˜‰v
-                    wrkArray[(int)DBGetData.NetProfit] += CostValue3[i];            // �ƒ—˜‰v
-                }
+                wrkArray[(int)DBGetData.NetProfit] += CostValue3.Sum();         // �ƒ—˜‰v
                 // ------------------------------------------------------------------------------------------
 
                 dgv.Rows.Add(objwrk[(int)DBGetData.DepartmentCode],
@@ -388,53 +385,6 @@
         }
         #endregion
 
-        #region ŒvŽZŠJŽn�E�I—¹“ú‚Ìƒ`ƒFƒbƒN“ü‚ê‘Ö‚¦
-        /// <summary>
-        /// ŒvŽZŠJŽn�E�I—¹“ú‚Ìƒ`ƒFƒbƒN“ü‚ê‘Ö‚¦
-        /// </summary>
-        private void CalcStartCompDate(DateTime dtDefaultStart, DateTime dtDefaultEnd,
-                                        DateTime HireStartDate, DateTime HireCompDate,
-                                        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;
-                }
-
-                // �Å‘å“ú‚ª�¡“ú‚æ‚è�¬‚³‚¢�ê�‡ˆÈŠO‚Í�ˆ—�‚µ‚È‚¢
-                if (CompDate.Date > DateTime.Today.Date) return;
-
-                if (numUDConstPro.Value != CommonMotions.SystemMasterData.BusinessPeriod)
-                {   // �¡ŠúˆÈŠO‚ÍŠú––
-                    CompDate = dtDefaultEnd;
-                }
-                else if (HireCompDate != DateTime.MinValue
-                        && (dtDefaultStart < HireCompDate && HireCompDate < dtDefaultEnd))
-                {   // ‘ÞŽÐ“ú‚ªŠú“à‚È‚ç‚Î�I—¹‚ð‘ÞŽÐ“ú‚É‚·‚é
-                    CompDate = HireCompDate;
-                }
-                else
-                {   // ˆÈŠO‚Í�¡“ú
-                    CompDate = DateTime.Today.Date;
-                }
-            }
-            catch (Exception ex)
-            {
-                logger.ErrorFormat("ƒVƒXƒeƒ€ƒGƒ‰�[�F{0}", ex.Message);
-            }
-        }
-        #endregion
-
         #region ‘Î�Û”N“x�‰ŠúƒZƒbƒg
         /// <summary>
         /// ‘Î�Û”N“x�‰ŠúƒZƒbƒg
@@ -734,362 +684,6 @@
         }
         #endregion
 
-        #region ƒfƒtƒHƒ‹ƒg‚ÌŠúŽñ“ú�EŠú––“ú‚ð‹�‚ß‚é
-        /// <summary>
-        /// ƒfƒtƒHƒ‹ƒg‚ÌŠúŽñ“ú�EŠú––“ú‚ð‹�‚ß‚é
-        /// </summary>
-        /// <param name="dtStart"></param>
-        /// <param name="dtEnd"></param>
-        private void CreateDefaultStartAndEndDate(ref DateTime dtStart, ref DateTime dtEnd)
-        {
-            try
-            {
-                // “–ŠúŠúŽñ”NŒŽ“ú‚ðŽæ“¾
-                int iYear = 0;
-                int month = 0;
-                int day = 0;
-                bool bPeriod = false;
-                if (CommonMotions.SystemMasterData.ConstructionNoBase == (int)CommonDefine.SystemConstructionNoBase.BusinessPeriod)
-                {   // ‰c‹ÆŠú
-                    iYear = CommonMotions.PeriodCountToYear(CommonMotions.cnvInt(numUDConstPro.Value));
-                    bPeriod = true;
-                }
-                else
-                {   // �HŽ–”N“x
-                    iYear = CommonMotions.SystemMasterData.ConstructionYear;
-                }
-                CommonMotions.GetBeginningMonthDay(bPeriod, ref month, ref day);
-                dtStart = new DateTime(iYear, month, day);
-                dtEnd = dtStart.AddYears(1).AddDays(-1);     // �I—¹‚Í�{1”N�|1“ú
-            }
-            catch (Exception ex)
-            {
-                logger.ErrorFormat("ƒVƒXƒeƒ€ƒGƒ‰�[�F{0}�F{1}", CommonMotions.GetMethodName(), ex.Message);
-            }
-        }
-        #endregion
-
-        #region ŠúŠÔƒf�[ƒ^Žæ“¾�‡
-        /// <summary>
-        /// ŠúŠÔƒf�[ƒ^Žæ“¾�‡
-        /// </summary>
-        private enum GetPersonTerm
-        {
-            DepartmentCode = 0,
-            /// <summary>
-            /// ’S“–ŽÒƒR�[ƒh
-            /// </summary>
-            PersonCode,
-            /// <summary>
-            /// ’S“–ŽÒ–¼
-            /// </summary>
-            PersonName,
-            /// <summary>
-            /// •\Ž¦�‡
-            /// </summary>
-            Displayorder,
-            /// <summary>
-            /// ŒŽŠz‹‹—^
-            /// </summary>
-            MonthlySalary,
-            /// <summary>
-            /// ’S“–ŽÒŒ_–ñ�HŠúŠJŽn
-            /// </summary>
-            MainStart1,
-            /// <summary>
-            /// ’S“–ŽÒŒ_–ñ�HŠú‰„’·ŠJŽn
-            /// </summary>
-            MainStart2,
-            /// <summary>
-            /// •›’S“–ŽÒŒ_–ñ�HŠúŠJŽn
-            /// </summary>
-            AssistStart1,
-            /// <summary>
-            /// •›’S“–ŽÒŒ_–ñ�HŠú‰„’·ŠJŽn
-            /// </summary>
-            AssistStart2,
-            /// <summary>
-            /// Žw“±ˆõŒ_–ñ�HŠúŠJŽn
-            /// </summary>
-            InstStart1,
-            /// <summary>
-            /// Žw“±ˆõŒ_–ñ�HŠú‰„’·ŠJŽn
-            /// </summary>
-            InstStart2,
-            /// <summary>
-            /// ’S“–ŽÒŒ_–ñ�HŠú�I—¹
-            /// </summary>
-            MainEnd1,
-            /// <summary>
-            /// ’S“–ŽÒŒ_–ñ�HŠú‰„’·�I—¹
-            /// </summary>
-            MainEnd2,
-            /// <summary>
-            /// •›’S“–ŽÒŒ_–ñ�HŠú�I—¹
-            /// </summary>
-            AssistEnd1,
-            /// <summary>
-            /// •›’S“–ŽÒŒ_–ñ�HŠú‰„’·�I—¹
-            /// </summary>
-            AssistEnd2,
-            /// <summary>
-            /// Žw“±ˆõŒ_–ñ�HŠú�I—¹
-            /// </summary>
-            InstEnd1,
-            /// <summary>
-            /// Žw“±ˆõŒ_–ñ�HŠú‰„’·�I—¹
-            /// </summary>
-            InstEnd2,
-            /// <summary>
-            /// ’S“–ŽÒ‹àŠz�WŒv
-            /// </summary>
-            MainSumAmount,
-            /// <summary>
-            /// •›’S“–ŽÒ‹àŠz�WŒv
-            /// </summary>
-            AssistSumAmount,
-            /// <summary>
-            /// Žw“±ˆõ‹àŠz�WŒv
-            /// </summary>
-            InstSumAmount,
-            /// <summary>
-            /// ’S“–ŽÒƒf�[ƒ^Œ��”
-            /// </summary>
-            MainDataCount,
-            /// <summary>
-            /// •›’S“–ŽÒƒf�[ƒ^Œ��”
-            /// </summary>
-            AssistDataCmount,
-            /// <summary>
-            /// Žw“±ˆõƒf�[ƒ^Œ��”
-            /// </summary>
-            InstDataCmount,
-            /// <summary>
-            /// ŒÙ—pŠJŽn“ú•t
-            /// </summary>
-            HireStartDays,
-            /// <summary>
-            /// ŒÙ—p�I—¹“ú•t
-            /// </summary>
-            HireCompDays,
-        }
-        #endregion
-
-        #region •”��“à‚Ì’S“–ŽÒƒR�[ƒh‚ðˆê——‚Å•Ô‚·
-        /// <summary>
-        /// •”��“à‚Ì’S“–ŽÒƒR�[ƒh‚ðˆê——‚Å•Ô‚·
-        /// </summary>
-        /// <param name="DepartmentCode">•”��ƒR�[ƒh</param>
-        /// <param name="PersonCode">’S“–ŽÒƒR�[ƒhˆê——</param>
-        /// <returns>ƒf�[ƒ^Œ��”</returns>
-        private int GetPersonInDepartment(ref List<int> DepartmentList, ref List<int> PersonCode,
-                                            ref List<DateTime> dtStart, ref List<DateTime> dtComp,
-                                            ref List<DateTime> dtMaxComp, ref List<int> MonthSalary,
-                                            ref List<DateTime> dtHireStDays, ref List<DateTime> dtHireEdDays)
-        {
-            IOMPersonInCharge PersonDB = new IOMPersonInCharge();
-            try
-            {
-                int DepartmentCode = GetDepartmentCode();
-                int NotOrder = CommonDefine.ProjectsStatus.First(x => x.Value.Equals("”ñ Žó ’�")).Key;
-
-                StringBuilder strSQL = new StringBuilder();
-                strSQL.Append("SELECT P.DEPARTMENTCODE, P.PERSONCODE, P.PERSONNAME, P.DISPLAYORDER, P.MonthlySalary,");
-                strSQL.Append(" MIN(C.CONSTRUCTIONPERIODSTART) M1, MIN(C.CONSTRUCTIONPERIODSTART2) M2,");
-                strSQL.Append(" MIN(D.CONSTRUCTIONPERIODSTART) S1, MIN(D.CONSTRUCTIONPERIODSTART2) S2,");
-                strSQL.Append(" MIN(E.CONSTRUCTIONPERIODSTART) I1, MIN(E.CONSTRUCTIONPERIODSTART2) I2,");
-                strSQL.Append(" MAX(C.CONSTRUCTIONPERIODEND) M3, MAX(C.CONSTRUCTIONPERIODEND2) M4,");
-                strSQL.Append(" MAX(D.CONSTRUCTIONPERIODEND) S3, MAX(D.CONSTRUCTIONPERIODEND2) S4,");
-                strSQL.Append(" MAX(E.CONSTRUCTIONPERIODEND) I3, MAX(E.CONSTRUCTIONPERIODEND2) I4,");
-                strSQL.Append(" SUM(C.EXECUTIONAMOUNT) M5, SUM(D.EXECUTIONAMOUNT) S5, SUM(E.EXECUTIONAMOUNT) I5,");
-                strSQL.Append(" COUNT(C.EXECUTIONAMOUNT) M6, COUNT(D.EXECUTIONAMOUNT) S6, COUNT(E.EXECUTIONAMOUNT) I6,");
-                strSQL.Append(" P.STARTDATE, P.ENDDATE");
-                strSQL.Append(" FROM PERSONINCHARGEMASTER P");
-
-                // �HŽ–’S“–ŽÒ‚Ìƒf�[ƒ^Žæ“¾
-                strSQL.Append(" LEFT JOIN (SELECT C1.CONSTRUCTIONPERSONCODE, C1.CONSTRUCTIONSTATUSFLG, C1.CONSTRUCTIONPERIOD");
-                strSQL.Append(", C1.CONSTRUCTIONPERIODSTART, C1.CONSTRUCTIONPERIODSTART2, C1.CONSTRUCTIONPERIODEND, C1.CONSTRUCTIONPERIODEND2, C2.EXECUTIONAMOUNT");
-                strSQL.Append(" FROM CONSTRUCTIONBASEINFO C1, CONSTRUCTIONLEDGERDETAIL C2, CONSTRUCTIONLEDGER C3");
-                strSQL.Append(" WHERE C2.CONSTRUCTIONCODE = C1.CONSTRUCTIONCODE");
-                strSQL.AppendFormat(" AND C2.GROUPCOUNT = {0}", (int)FrmConstructionLedger.DataGroup.Payroll);
-                strSQL.Append(" AND C3.CONSTRUCTIONCODE = C1.CONSTRUCTIONCODE) C");
-                strSQL.Append(" ON C.CONSTRUCTIONPERSONCODE = P.PERSONCODE");
-                strSQL.AppendFormat(" AND C.CONSTRUCTIONSTATUSFLG <> {0}", NotOrder);
-                strSQL.AppendFormat(" AND C.CONSTRUCTIONPERIOD = {0}", numUDConstPro.Value);
-
-                // �HŽ–•›’S“–ŽÒ‚Ìƒf�[ƒ^Žæ“¾
-                strSQL.Append(" LEFT JOIN (SELECT D1.CONSTRSUBPERSONCODE CONSTRUCTIONPERSONCODE, D1.CONSTRUCTIONSTATUSFLG, D1.CONSTRUCTIONPERIOD");
-                strSQL.Append(", D1.CONSTRUCTIONPERIODSTART, D1.CONSTRUCTIONPERIODSTART2, D1.CONSTRUCTIONPERIODEND, D1.CONSTRUCTIONPERIODEND2, D2.EXECUTIONAMOUNT");
-                strSQL.Append(" FROM CONSTRUCTIONBASEINFO D1, CONSTRUCTIONLEDGERDETAIL D2, CONSTRUCTIONLEDGER D3");
-                strSQL.Append(" WHERE D2.CONSTRUCTIONCODE = D1.CONSTRUCTIONCODE");
-                strSQL.AppendFormat(" AND D2.GROUPCOUNT = {0}", (int)FrmConstructionLedger.DataGroup.Assistant);
-                strSQL.Append(" AND D3.CONSTRUCTIONCODE = D1.CONSTRUCTIONCODE) D");
-                strSQL.Append(" ON D.CONSTRUCTIONPERSONCODE = P.PERSONCODE");
-                strSQL.AppendFormat(" AND D.CONSTRUCTIONSTATUSFLG <> {0}", NotOrder);
-                strSQL.AppendFormat(" AND D.CONSTRUCTIONPERIOD = {0}", numUDConstPro.Value);
-
-                // �HŽ–Žw“±ˆõ‚Ìƒf�[ƒ^Žæ“¾
-                strSQL.Append(" LEFT JOIN (SELECT E1.CONSTRUCTIONINSTRUCTOR CONSTRUCTIONPERSONCODE, E1.CONSTRUCTIONSTATUSFLG, E1.CONSTRUCTIONPERIOD");
-                strSQL.Append(", E1.CONSTRUCTIONPERIODSTART, E1.CONSTRUCTIONPERIODSTART2, E1.CONSTRUCTIONPERIODEND, E1.CONSTRUCTIONPERIODEND2, E2.EXECUTIONAMOUNT");
-                strSQL.Append(" FROM CONSTRUCTIONBASEINFO E1, CONSTRUCTIONLEDGERDETAIL E2, CONSTRUCTIONLEDGER E3");
-                strSQL.Append(" WHERE E2.CONSTRUCTIONCODE = E1.CONSTRUCTIONCODE");
-                strSQL.AppendFormat(" AND E2.GROUPCOUNT = {0}", (int)FrmConstructionLedger.DataGroup.Instructor);
-                strSQL.Append(" AND E3.CONSTRUCTIONCODE = E1.CONSTRUCTIONCODE) E");
-                strSQL.Append(" ON E.CONSTRUCTIONPERSONCODE = P.PERSONCODE");
-                strSQL.AppendFormat(" AND E.CONSTRUCTIONSTATUSFLG <> {0}", NotOrder);
-                strSQL.AppendFormat(" AND E.CONSTRUCTIONPERIOD = {0}", numUDConstPro.Value);
-
-                strSQL.AppendFormat(" WHERE P.LEDGERFLG = {0}", (int)CommonDefine.PersonLedgerDivNo.CalcTarget);
-
-                // “–ŠúŠúŽñ“ú�EŠú––“ú‚ðŽæ“¾
-                DateTime dtDefaultStart = DateTime.MinValue;
-                DateTime dtDefaultEnd = DateTime.MinValue;
-                CreateDefaultStartAndEndDate(ref dtDefaultStart, ref dtDefaultEnd);
-                strSQL.AppendFormat(" AND (DATE(P.STARTDATE) <= STR_TO_DATE('{0}','%Y/%m/%d')", dtDefaultEnd.ToShortDateString());
-                strSQL.AppendFormat(" AND (STR_TO_DATE('{0}','%Y/%m/%d') <= DATE(P.ENDDATE)", dtDefaultStart.ToShortDateString());
-                strSQL.AppendFormat(" OR STR_TO_DATE('{0}','%Y/%m/%d') = DATE(P.ENDDATE)))", DateTime.MinValue.ToShortDateString());
-
-                if (CommonMotions.LoginUserData.PersonCode != CommonDefine.AdminCode)
-                {
-                    strSQL.Append(" AND P.DEPARTMENTCODE IN (select PDep.DepartmentCode from PersonDepartmentMaster AS PDep");
-                    strSQL.AppendFormat(" WHERE PDep.PersonCode = {0})", CommonMotions.LoginUserData.PersonCode);
-                }
-
-                // �HŽ–‘ä’ ƒf�[ƒ^‚Ì•”��‚¾‚¯‚ª‘Î�Û
-                if (DepartmentCode == 0)
-                {
-                    strSQL.Append(" AND P.DEPARTMENTCODE IN");
-                    strSQL.Append(" (SELECT AA.DEPARTMENTCODE FROM (SELECT A.DEPARTMENTCODE, A.DEPARTMENTSTRING, A.DISPLAYORDER, COUNT(*) CNT");
-                    strSQL.Append(" FROM DEPARTMENTMASTER A, PERSONINCHARGEMASTER B, CONSTRUCTIONBASEINFO C , CONSTRUCTIONLEDGERDETAIL D");
-                    strSQL.Append(" WHERE A.DELETEFLG = 0");
-                    strSQL.Append(" AND A.DEPARTMENTCODE = B.DEPARTMENTCODE");
-                    strSQL.Append(" AND B.PERSONCODE = C.CONSTRUCTIONPERSONCODE");
-                    strSQL.Append(" AND D.CONSTRUCTIONCODE = C.CONSTRUCTIONCODE");
-
-                    strSQL.Append(" GROUP BY A.DEPARTMENTCODE, A.DEPARTMENTSTRING, A.DISPLAYORDER) AA)");
-                }
-                else
-                {
-                    // •”��ƒR�[ƒh‘I‘ðŽž‚Í•”��‚ðŒŸ�õ�ðŒ�‚Ö“ü‚ê‚é
-                    strSQL.AppendFormat(" AND P.DEPARTMENTCODE = {0}", DepartmentCode);
-                }
-
-                strSQL.Append(" GROUP BY P.DEPARTMENTCODE, P.PERSONCODE, P.PERSONNAME, P.DISPLAYORDER, P.MonthlySalary, P.STARTDATE, P.ENDDATE");
-                strSQL.Append(" ORDER BY P.DISPLAYORDER");
-
-                ArrayList arList = new ArrayList();
-                if (!PersonDB.ExecuteReader(strSQL.ToString(), ref arList)) return 0;
-
-                DateTime stDate = DateTime.MaxValue;
-                DateTime edDate = DateTime.MinValue;
-                DateTime maxDate = DateTime.MinValue;
-                foreach (object[] objRec in arList)
-                {
-                    stDate = DateTime.MaxValue;
-                    edDate = DateTime.MinValue;
-                    maxDate = DateTime.MinValue;
-
-                    // •”��ƒR�[ƒh‚ðŽæ“¾‚·‚é
-                    int Department = CommonMotions.cnvInt(objRec[(int)GetPersonTerm.DepartmentCode]);
-                    // ’S“–ŽÒƒR�[ƒh‚ðŽæ“¾‚·‚é
-                    int Person = CommonMotions.cnvInt(objRec[(int)GetPersonTerm.PersonCode]);
-
-                    DateTime wrkDate = DateTime.MinValue;
-                    // �Å�¬‚ÌŠJŽn“ú‚ðŽæ“¾‚·‚é
-                    //stDate = dtDefaultStart;
-                    wrkDate = CommonMotions.cnvDate(objRec[(int)GetPersonTerm.MainStart1]).Date;
-                    if (wrkDate != DateTime.MinValue && wrkDate < stDate) stDate = wrkDate;
-                    wrkDate = CommonMotions.cnvDate(objRec[(int)GetPersonTerm.MainStart2]).Date;
-                    if (wrkDate != DateTime.MinValue && wrkDate < stDate) stDate = wrkDate;
-
-                    // �Å‘å‚Ì�I—¹“ú‚ðŽæ“¾‚·‚é
-                    //maxDate = dtDefaultEnd;
-                    wrkDate = CommonMotions.cnvDate(objRec[(int)GetPersonTerm.MainEnd1]).Date;
-                    if (wrkDate != DateTime.MinValue && wrkDate > maxDate) maxDate = wrkDate;
-                    wrkDate = CommonMotions.cnvDate(objRec[(int)GetPersonTerm.MainEnd2]).Date;
-                    if (wrkDate != DateTime.MinValue && wrkDate > maxDate) maxDate = wrkDate;
-
-                    // ŒvŽZ‚Ì�I—¹“ú‚ðŽæ“¾‚·‚é
-                    //edDate = dtDefaultEnd;
-                    // ŒŽŠz‹‹—^‚ðŽæ“¾‚·‚é
-                    int Salary = CommonMotions.cnvInt(objRec[(int)GetPersonTerm.MonthlySalary]);
-
-                    // ŒÙ—pŠJŽn�E�I—¹“ú‚ðŽæ“¾‚·‚é
-                    DateTime dtHireStDay = CommonMotions.cnvDate(objRec[(int)GetPersonTerm.HireStartDays]);
-                    DateTime dtHireEdDay = CommonMotions.cnvDate(objRec[(int)GetPersonTerm.HireCompDays]);
-
-                    DepartmentList.Add(Department);     // •”��ƒR�[ƒh
-                    PersonCode.Add(Person);             // ’S“–ŽÒƒR�[ƒh
-                    dtStart.Add(stDate);                // ŠJŽn“ú
-                    dtComp.Add(edDate);                 // �I—¹“ú
-                    dtMaxComp.Add(maxDate);             // �Å‘å�I—¹“ú
-                    MonthSalary.Add(Salary);            // ‹‹—^‹àŠz
-                    dtHireStDays.Add(dtHireStDay);      // ŒÙ—pŠJŽn“ú
-                    dtHireEdDays.Add(dtHireEdDay);      // ŒÙ—p�I—¹“ú
-                }
-                return arList.Count;
-            }
-            catch (Exception ex)
-            {
-                logger.ErrorFormat("ƒVƒXƒeƒ€ƒGƒ‰�[�F{0}�F{1}", CommonMotions.GetMethodName(), ex.Message);
-                return 0;
-            }
-            finally
-            {
-                PersonDB.close(); PersonDB = null;
-            }
-        }
-        #endregion
-
-        #region ’S“–ŽÒ–ˆ”ï–Ú–ˆ‚ÌŒo”ï‚ðŽæ“¾‚·‚é
-        /// <summary>
-        /// ’S“–ŽÒ–ˆ”ï–Ú–ˆ‚ÌŒo”ï‚ðŽæ“¾‚·‚é
-        /// </summary>
-        /// <param name="PersonCode">’S“–ŽÒƒR�[ƒh</param>
-        /// <param name="dtStart">ŠJŽn“ú•t</param>
-        /// <param name="dtEnd">�I—¹“ú•t</param>
-        /// <param name="CostValue">”ï–Ú–ˆŒo”ï</param>
-        private void GetPersonExpensesCostValue(int PersonCode, DateTime dtStart, DateTime dtEnd, ref int[] CostValue)
-        {
-            IOCostDataOfPerson CostDB = new IOCostDataOfPerson();
-            try
-            {
-                // ’S“–ŽÒ–ˆŒo”ïƒf�[ƒ^‚æ‚è‚Ç‚±‚Ì�HŽ–‚É‚à�Š‘®‚µ‚Ä‚¢‚È‚¢Œo”ï‚ðŽæ“¾‚·‚é
-                StringBuilder strSQL = new StringBuilder();
-                strSQL.Append("SELECT PERSONCODE, DATATYPE, SUM(ENTRYPRICE) FROM COSTDATAOFPERSON");
-                strSQL.AppendFormat(" WHERE PERSONCODE = {0}", PersonCode);
-                strSQL.AppendFormat(" AND ('{0}' <= DATE_FORMAT(ACTIONDATE,'%Y/%m/%d')", dtStart.ToShortDateString());
-                strSQL.AppendFormat(" AND DATE_FORMAT(ACTIONDATE,'%Y/%m/%d') <= '{0}')", dtEnd.ToShortDateString());
-                strSQL.Append(" AND CONSTRUCTIONCODE = 0");
-                strSQL.Append(" GROUP BY PERSONCODE, DATATYPE");
-                strSQL.Append(" ORDER BY PERSONCODE, DATATYPE");
-                ArrayList arList = new ArrayList();
-                if (!CostDB.ExecuteReader(strSQL.ToString(), ref arList)) return;
-
-                // Žæ“¾Œ‹‰Ê‚ð�U‚è•ª‚¯‚é
-                foreach (object[] wrkobj in arList)
-                {
-                    for (int i = 1; i < CommonDefine.CostDataNoString.Length; i++)
-                    {
-                        if (CommonMotions.cnvInt(wrkobj[1]) == i)
-                        {
-                            CostValue[i] += CommonMotions.cnvInt(wrkobj[2]);
-                            break;
-                        }
-                    }
-                }
-            }
-            catch (Exception ex)
-            {
-                logger.ErrorFormat("ƒVƒXƒeƒ€ƒGƒ‰�[�F{0}�F{1}", CommonMotions.GetMethodName(), ex.Message);
-            }
-            finally
-            {
-                CostDB.close(); CostDB = null;
-            }
-        }
-        #endregion
-
         #region •”��–ˆ‚Ì•â�•�U•ª‚ðŽæ“¾‚·‚é
         /// <summary>
         /// •”��–ˆ‚Ì•â�•�U•ª‚ðŽæ“¾‚·‚é
@@ -1109,10 +703,13 @@
                 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 = {0}", (int)FrmConstructionLedger.DataGroup.Instructor);
-                
-                strSQL.Append(" AND P.COMPANYCODE IN (SELECT P1.PERSONCODE FROM PERSONINCHARGEMASTER P1 WHERE P1.DELETEFLG = 0");
+                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)
                 {
                     strSQL.Append(" AND P1.DEPARTMENTCODE IN (select PDep.DepartmentCode from PersonDepartmentMaster AS PDep");
@@ -1123,31 +720,7 @@
                 if (PersonCode != 0) strSQL.AppendFormat(" AND P1.PERSONCODE = {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");
 
-                strSQL.Append(" UNION");
-                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 = {0}", (int)FrmConstructionLedger.DataGroup.Assistant);
-
-                strSQL.Append(" AND P.COMPANYCODE IN (SELECT P1.PERSONCODE FROM PERSONINCHARGEMASTER P1 WHERE P1.DELETEFLG = 0");
-
-                if (CommonMotions.LoginUserData.PersonCode != CommonDefine.AdminCode)
-                {
-                    strSQL.Append(" AND P1.DEPARTMENTCODE IN (select PDep.DepartmentCode from PersonDepartmentMaster AS PDep");
-                    strSQL.AppendFormat(" WHERE PDep.PersonCode = {0})", CommonMotions.LoginUserData.PersonCode);
-                }
-
-                if (DepartmentCode != 0) strSQL.AppendFormat(" AND P1.DEPARTMENTCODE = {0}", DepartmentCode);
-                if (PersonCode != 0) strSQL.AppendFormat(" AND P1.PERSONCODE = {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);
@@ -1180,119 +753,6 @@
         }
         #endregion
 
-        #region �HŽ–�Ú�×‘ä’ ‚æ‚è�U•ª‹‹—^‹àŠz�E‘e—˜‰v‚ðŽæ“¾‚·‚é
-        /// <summary>
-        /// �HŽ–�Ú�×‘ä’ ‚æ‚è�U•ª‹‹—^‹àŠz�E‘e—˜‰v‚ðŽæ“¾‚·‚é
-        /// </summary>
-        /// <param name="OnSalary">�U•ª‹‹—^‹àŠz</param>
-        /// <param name="NetIncome">�ƒ—˜‰v‹àŠz</param>
-        /// <param name="NonSalary">‘e—˜‰v‹àŠz</param>
-        private void ProfitGeneral(int DepartmentCode, int PersonCode, ref int OnSalary, ref int NetIncome, ref int NonSalary)
-        {
-            IOConstructionLedger LedgerlDB = new IOConstructionLedger();
-            try
-            {
-                // •”��ƒR�[ƒhŽæ“¾
-                int NotOrder = CommonDefine.ProjectsStatus.First(x => x.Value.Equals("”ñ Žó ’�")).Key;
-
-                // �U•ª‹‹—^‹àŠzŽæ“¾
-                StringBuilder strSQL = new StringBuilder();
-                strSQL.Append("SELECT SUM(C.EXECUTIONAMOUNT) FROM CONSTRUCTIONLEDGER P, CONSTRUCTIONBASEINFO B, CONSTRUCTIONLEDGERDETAIL C, PERSONINCHARGEMASTER D");
-                // �U•ª–³‚Å‚Í–³‚¢
-                strSQL.Append(" WHERE P.CONSTRUCTIONCODE IN (SELECT A.CONSTRUCTIONCODE FROM CONSTRUCTIONLEDGERDETAIL A");
-                strSQL.AppendFormat(" WHERE A.GROUPCOUNT = {0} AND (A.SALARYFLG = {1} OR A.SALARYFLG = {2}))"
-                                        , (int)FrmConstructionLedger.DataGroup.Payroll
-                                        , (int)CommonDefine.SalaryDevision.All
-                                        , (int)CommonDefine.SalaryDevision.DaysInput);
-
-                strSQL.Append(" AND P.CONSTRUCTIONCODE = B.CONSTRUCTIONCODE");
-                strSQL.AppendFormat(" AND B.CONSTRUCTIONPERIOD = {0}", numUDConstPro.Value);
-                strSQL.AppendFormat(" AND B.CONSTRUCTIONSTATUSFLG != {0}", NotOrder);
-                strSQL.Append(" AND C.CONSTRUCTIONCODE = P.CONSTRUCTIONCODE");
-                strSQL.AppendFormat(" AND C.GROUPCOUNT = {0}", (int)FrmConstructionLedger.DataGroup.Payroll);
-                strSQL.Append(" AND D.PERSONCODE = B.CONSTRUCTIONPERSONCODE");
-
-                if (CommonMotions.LoginUserData.PersonCode != CommonDefine.AdminCode)
-                {
-                    strSQL.Append(" AND D.DEPARTMENTCODE IN (select PDep.DepartmentCode from PersonDepartmentMaster AS PDep");
-                    strSQL.AppendFormat(" WHERE PDep.PersonCode = {0})", CommonMotions.LoginUserData.PersonCode);
-                }
-
-                if (DepartmentCode != 0) strSQL.AppendFormat(" AND D.DEPARTMENTCODE = {0}", DepartmentCode);
-                if (PersonCode != 0) strSQL.AppendFormat(" AND D.PERSONCODE = {0}", PersonCode);
-
-                ArrayList arList = new ArrayList();
-                if (!LedgerlDB.ExecuteReader(strSQL.ToString(), ref arList)) return;
-                object[] objSalary = (object[])arList[0];
-                OnSalary = CommonMotions.cnvInt(objSalary[0]);
-
-                // �U•ª�Ï‚Ý•ª�ƒ—˜‰vŽæ“¾
-                strSQL.Clear();
-                strSQL.Append("SELECT SUM(P.NETPROFIT) FROM CONSTRUCTIONLEDGER P, CONSTRUCTIONBASEINFO B, PERSONINCHARGEMASTER D");
-                // �U•ª�Ï‚Ý•ª�ƒ—˜‰v
-                strSQL.Append(" WHERE P.CONSTRUCTIONCODE IN (SELECT A.CONSTRUCTIONCODE  FROM CONSTRUCTIONLEDGERDETAIL A");
-                strSQL.AppendFormat(" WHERE A.GROUPCOUNT = {0} AND (A.SALARYFLG = {1} OR A.SALARYFLG = {2}))"
-                                        , (int)FrmConstructionLedger.DataGroup.Payroll
-                                        , (int)CommonDefine.SalaryDevision.All
-                                        , (int)CommonDefine.SalaryDevision.DaysInput);
-                
-                strSQL.Append(" AND P.CONSTRUCTIONCODE = B.CONSTRUCTIONCODE");
-                strSQL.AppendFormat(" AND B.CONSTRUCTIONPERIOD = {0}", numUDConstPro.Value);
-                strSQL.AppendFormat(" AND B.CONSTRUCTIONSTATUSFLG != {0}", NotOrder);
-                strSQL.Append(" AND D.PERSONCODE = B.CONSTRUCTIONPERSONCODE");
-
-                if (CommonMotions.LoginUserData.PersonCode != CommonDefine.AdminCode)
-                {
-                    strSQL.Append(" AND D.DEPARTMENTCODE IN (select PDep.DepartmentCode from PersonDepartmentMaster AS PDep");
-                    strSQL.AppendFormat(" WHERE PDep.PersonCode = {0})", CommonMotions.LoginUserData.PersonCode);
-                }
-
-                if (DepartmentCode != 0) strSQL.AppendFormat(" AND D.DEPARTMENTCODE = {0}", DepartmentCode);
-
-                ArrayList arList2 = new ArrayList();
-                if (!LedgerlDB.ExecuteReader(strSQL.ToString(), ref arList2)) return;
-                object[] objNetIncome = (object[])arList2[0];
-                NetIncome = CommonMotions.cnvInt(objNetIncome[0]);
-
-                // �U•ª–³‚µ•ª�ƒ—˜‰vŽæ“¾
-                strSQL.Clear();
-                strSQL.Append("SELECT SUM(P.NETPROFIT) FROM CONSTRUCTIONLEDGER P, CONSTRUCTIONBASEINFO B, PERSONINCHARGEMASTER D");
-                // �U•ª�Ï‚Ý•ª�ƒ—˜‰v
-                strSQL.Append(" WHERE P.CONSTRUCTIONCODE NOT IN (SELECT A.CONSTRUCTIONCODE  FROM CONSTRUCTIONLEDGERDETAIL A");
-                strSQL.AppendFormat(" WHERE A.GROUPCOUNT = {0} AND (A.SALARYFLG = {1} OR A.SALARYFLG = {2}))"
-                                        , (int)FrmConstructionLedger.DataGroup.Payroll
-                                        , (int)CommonDefine.SalaryDevision.All
-                                        , (int)CommonDefine.SalaryDevision.DaysInput);
-
-                strSQL.Append(" AND P.CONSTRUCTIONCODE = B.CONSTRUCTIONCODE");
-                strSQL.AppendFormat(" AND B.CONSTRUCTIONPERIOD = {0}", numUDConstPro.Value);
-                strSQL.AppendFormat(" AND B.CONSTRUCTIONSTATUSFLG != {0}", NotOrder);
-                strSQL.Append(" AND D.PERSONCODE = B.CONSTRUCTIONPERSONCODE");
-
-                if (CommonMotions.LoginUserData.PersonCode != CommonDefine.AdminCode)
-                {
-                    strSQL.Append(" AND D.DEPARTMENTCODE IN (select PDep.DepartmentCode from PersonDepartmentMaster AS PDep");
-                    strSQL.AppendFormat(" WHERE PDep.PersonCode = {0})", CommonMotions.LoginUserData.PersonCode);
-                }
-
-                if (DepartmentCode != 0) strSQL.AppendFormat(" AND D.DEPARTMENTCODE = {0}", DepartmentCode);
-
-                ArrayList arList3 = new ArrayList();
-                if (!LedgerlDB.ExecuteReader(strSQL.ToString(), ref arList3)) return;
-                object[] objNonSalary = (object[])arList3[0];
-                NonSalary = CommonMotions.cnvInt(objNonSalary[0]);
-            }
-            catch (Exception ex)
-            {
-                logger.ErrorFormat("ƒVƒXƒeƒ€ƒGƒ‰�[�F{0}�F{1}", CommonMotions.GetMethodName(), ex.Message);
-            }
-            finally
-            {
-                LedgerlDB.close(); LedgerlDB = null;
-            }
-        }
-        #endregion 
-
         #region ˆê——ƒf�[ƒ^•\Ž¦�ˆ—�
         /// <summary>
         /// ˆê——ƒf�[ƒ^•\Ž¦�ˆ—�
@@ -1301,6 +761,7 @@
         {
             IOConstructionLedger LedgerDB = new IOConstructionLedger();
             IOMPersonInCharge SalaryDB = new IOMPersonInCharge();
+            IOCostDataOfPerson CostDB = new IOCostDataOfPerson();
             DataGridView dgv = dgvMaster;
             ProgressBar prgber = ProgressBar;
             int initDataCount = 0;
@@ -1316,18 +777,11 @@
                 prgber.Value = 0;
 
                 // ----- ’S“–ŽÒ–ˆ‚ÌŽw’èŠú‚ÌŠJŽn�E�I—¹”NŒŽ“ú‚ðŽæ“¾‚·‚é
-                List<int> DepInPerArray = new List<int>();
-                List<int> PersonCDArray = new List<int>();
-                List<DateTime> dtStartArray = new List<DateTime>();
-                List<DateTime> dtCompArray = new List<DateTime>();
-                List<DateTime> dtMaxCompArray = new List<DateTime>();
-                List<int> SalaryArray = new List<int>();
-                List<DateTime> dtHireStDayArray = new List<DateTime>();
-                List<DateTime> dtHireEdDayArray = new List<DateTime>();
-                GetPersonInDepartment(ref DepInPerArray, ref PersonCDArray,
-                                        ref dtStartArray, ref dtCompArray,
-                                        ref dtMaxCompArray, ref SalaryArray,
-                                        ref dtHireStDayArray, ref dtHireEdDayArray);
+                ArrayList TargetList = new ArrayList();
+                CreateLedgerSQL.GetPersonInDepartment((int)numUDConstPro.Value,
+                                                    GetDepartmentCode(),
+                                                    0,
+                                                    ref TargetList);
 
                 // ProgressBar‚Ì’l‚ð•Ï�X‚·‚é
                 prgber.Value++;
@@ -1336,12 +790,10 @@
                 // ƒfƒtƒHƒ‹ƒgŠJŽn�E�I—¹‚ðŽæ“¾‚·‚é
                 DateTime dtDefaultStart = DateTime.MinValue;
                 DateTime dtDefaultEnd = DateTime.MinValue;
-                CreateDefaultStartAndEndDate(ref dtDefaultStart, ref dtDefaultEnd);
+                CreateLedgerSQL.CreateDefaultStartAndEndDate((int)numUDConstPro.Value, ref dtDefaultStart, ref dtDefaultEnd);
 
                 // ----- Œo‰ß‹‹—^•\Ž¦�iƒwƒbƒ_�[‚É•\Ž¦�j
-                SetPayrollData(PersonCDArray, dtDefaultStart, dtDefaultEnd,
-                                dtStartArray, dtMaxCompArray,
-                                dtHireStDayArray, dtHireEdDayArray, SalaryDB);
+                SetPayrollData(TargetList, dtDefaultStart, dtDefaultEnd, SalaryDB, LedgerDB);
 
                 // ProgressBar‚Ì’l‚ð•Ï�X‚·‚é
                 prgber.Value++;
@@ -1388,10 +840,8 @@
                 {
                     // ƒf�[ƒ^•\Ž¦
                     CreateRowBlock(DispType, arData, ref ino, ref TotalArea,
-                                    DepInPerArray, PersonCDArray,
-                                    dtStartArray, dtMaxCompArray, SalaryArray,
-                                        dtHireStDayArray, dtHireEdDayArray,
-                                        dtDefaultStart, dtDefaultEnd, true, SalaryDB);
+                                        TargetList,
+                                        dtDefaultStart, dtDefaultEnd, true, SalaryDB, LedgerDB, CostDB);
                 }
 
                 // •”��‚²‚Æˆê——‚Ì�ê�‡‚Í‘Þ�EŽÒ‚Å‚àƒf�[ƒ^‚ª‚ ‚ê‚Î•\Ž¦‚·‚é
@@ -1404,10 +854,8 @@
                     if (arData.Count > 0)
                     {
                         CreateRowBlock(DispType, arData, ref ino, ref RetireeTotalArea,
-                                        DepInPerArray, PersonCDArray,
-                                        dtStartArray, dtMaxCompArray, SalaryArray,
-                                            dtHireStDayArray, dtHireEdDayArray,
-                                            dtDefaultStart, dtDefaultEnd, false, SalaryDB);
+                                        TargetList,
+                                        dtDefaultStart, dtDefaultEnd, false, SalaryDB, LedgerDB, CostDB);
                         for (int i = 0; i < TotalArea.Length; i++)
                         {
                             TotalArea[i] += RetireeTotalArea[i];
@@ -1447,6 +895,7 @@
 
                 LedgerDB.close(); LedgerDB = null;
                 SalaryDB.close(); SalaryDB = null;
+                CostDB.close(); CostDB = null;
                 dgv.ResumeLayout();
 
                 // ProgressBar‚Ì’l‚ð•Ï�X‚·‚é
@@ -1462,11 +911,9 @@
         /// ‘I‘ð‚³‚ê‚½ƒf�[ƒ^‚ð�‡Œv‚Æ‹¤‚É•\Ž¦‚·‚é
         /// </summary>
         private void CreateRowBlock(int DispType, ArrayList arData, ref int ino, ref int[] TotalArea,
-                                    List<int> DepInPerArray, List<int> PersonCDArray,
-                                    List<DateTime> dtStartArray, List<DateTime> dtCompArray, List<int> SalaryArray,
-                                    List<DateTime> dtHireStDayArray, List<DateTime> dtHireEdDayArray,
+                                    ArrayList TargetList,
                                     DateTime dtDefaultStart, DateTime dtDefaultEnd, bool IncumbentsFlg,
-                                    IOMPersonInCharge SalaryDB)
+                                    IOMPersonInCharge SalaryDB, IOConstructionLedger LedgerDB, IOCostDataOfPerson CostDB)
         {
             DataGridView dgv = dgvMaster;
             ProgressBar prgber = ProgressBar;
@@ -1477,9 +924,8 @@
                 {
                     // ƒOƒŠƒbƒh‚Öƒf�[ƒ^•\Ž¦
                     GridDataSet(objwrk, ref ino, ref TotalArea,
-                                DepInPerArray, PersonCDArray, dtStartArray, dtCompArray, SalaryArray,
-                                dtHireStDayArray, dtHireEdDayArray,
-                                dtDefaultStart, dtDefaultEnd, SalaryDB);
+                                TargetList,
+                                dtDefaultStart, dtDefaultEnd, SalaryDB, LedgerDB, CostDB);
                 }
 
                 dgv.Columns[(int)DispColumn.SelectionName].HeaderText = GridColumnHeader[DispType];
@@ -1556,21 +1002,23 @@
                 strSQL.Append("SELECT");
 
                 strSQL.Append(" C.DEPARTMENTCODE");
-                strSQL.Append(" ,D.DEPARTMENTSTRING");
-                strSQL.Append(" ,D.DISPLAYORDER");
-                strSQL.Append(" ,SUM(A.ORDERSDECISIONPRICE)");
-                strSQL.Append(" ,SUM(A.COMPANYEXPENSES)");
-                strSQL.Append(" ,SUM(A.DEPARTMENTEXPENSES)");
-                strSQL.Append(" ,SUM(A.SALESEXPENSES)");
-                strSQL.Append(" ,SUM(A.TOTALPAYMENT)");
-                strSQL.Append(" ,SUM(A.GROSSPROFIT)");
-                strSQL.Append(" ,SUM(A.NETPROFIT)");
+                strSQL.Append(", D.DEPARTMENTSTRING");
+                strSQL.Append(", D.DISPLAYORDER");
+                strSQL.Append(", SUM(A.ORDERSDECISIONPRICE)");
+                strSQL.Append(", SUM(A.COMPANYEXPENSES)");
+                strSQL.Append(", SUM(A.DEPARTMENTEXPENSES)");
+                strSQL.Append(", SUM(A.SALESEXPENSES)");
+                strSQL.Append(", SUM(A.TOTALPAYMENT)");
+                strSQL.Append(", SUM(A.GROSSPROFIT)");
+                strSQL.Append(", SUM(A.NETPROFIT)");
 
                 strSQL.Append(" FROM PERSONINCHARGEMASTER C");
-                strSQL.Append(" LEFT JOIN CONSTRUCTIONBASEINFO B ON B.CONSTRUCTIONPERSONCODE = C.PERSONCODE");
+                strSQL.Append(" LEFT JOIN CONSTRUCTIONBASEINFO B");
+                strSQL.Append(" ON B.CONSTRUCTIONPERSONCODE = C.PERSONCODE");
                 strSQL.AppendFormat(" AND B.CONSTRUCTIONPERIOD = {0}", numUDConstPro.Value);
                 strSQL.AppendFormat(" AND B.CONSTRUCTIONSTATUSFLG != {0}", NotOrder);
                 strSQL.AppendFormat(" AND B.TyingFlg != {0}", (int)CommonDefine.BaseInfoTyingFlg.Tying);
+                strSQL.AppendFormat(" AND B.JoinFlg != {0}", (int)CommonDefine.BaseInfoJoinFlg.JoinChildren);
                 strSQL.Append(" LEFT JOIN CONSTRUCTIONLEDGER A ON A.CONSTRUCTIONCODE = B.CONSTRUCTIONCODE,");
                 strSQL.Append(" DEPARTMENTMASTER D");
                 strSQL.Append(" WHERE B.CONSTRUCTIONPERSONCODE = C.PERSONCODE");
@@ -1636,6 +1084,7 @@
                 strSQL.AppendFormat(" AND B.CONSTRUCTIONPERIOD = {0}", numUDConstPro.Value);
                 strSQL.AppendFormat(" AND B.CONSTRUCTIONSTATUSFLG != {0}", NotOrder);
                 strSQL.AppendFormat(" AND B.TyingFlg != {0}", (int)CommonDefine.BaseInfoTyingFlg.Tying);
+                strSQL.AppendFormat(" AND B.JoinFlg != {0}", (int)CommonDefine.BaseInfoJoinFlg.JoinChildren);
                 strSQL.Append(" LEFT JOIN CONSTRUCTIONLEDGER A ON A.CONSTRUCTIONCODE = B.CONSTRUCTIONCODE");
                 strSQL.AppendFormat(" WHERE C.DEPARTMENTCODE = {0}", DepCode);
                 
@@ -1722,10 +1171,9 @@
         /// <summary>
         /// �¡Šú‚ÌŒo‰ß‹‹—^‚ð•\Ž¦‚·‚é
         /// </summary>
-        private void SetPayrollData(List<int> PersonCDArray, DateTime dtDefaultStart, DateTime dtDefaultEnd,
-                                    List<DateTime> dtStartArray, List<DateTime> dtMaxCompArray,
-                                    List<DateTime> dtHireStDayArray, List<DateTime> dtHireEdDayArray,
-                                    IOMPersonInCharge SalaryDB)
+        private void SetPayrollData(ArrayList TargetList,
+                                    DateTime dtDefaultStart, DateTime dtDefaultEnd,
+                                    IOMPersonInCharge SalaryDB, IOConstructionLedger LedgerDB)
         {
             try
             {
@@ -1736,8 +1184,6 @@
 
                 int TotalSalary = 0;        // ‹‹—^—Ý�ÏŽæ“¾
                 int OnSalary = 0;           // �U•ª‹‹—^‹àŠzŽæ“¾
-                int NetIncome = 0;          // �ƒ—˜‰v‹àŠzŽæ“¾
-                int NonSalary = 0;          // ‘e—˜‰v‹àŠzŽæ“¾
 
                 DateTime stDate = DateTime.Today;
                 DateTime edDate = DateTime.Today;
@@ -1745,15 +1191,20 @@
                 DateTime DspEdDate = DateTime.MinValue;
 
                 // ‹‹—^‚ð�WŒv‚·‚é
-                for (int i = 0; i < PersonCDArray.Count; i++)
+                foreach (object[] ObjRec in TargetList)
                 {
                     // ŠJŽn�E�I—¹“ú‚ª–³‚¢�ê�‡‚ÍƒfƒtƒHƒ‹ƒg‚ÌŠúŽñ�EŠú––‚ðŽg—p‚·‚é
-                    stDate = dtStartArray[i];
-                    edDate = dtMaxCompArray[i];
-                    CalcStartCompDate(dtDefaultStart, dtDefaultEnd, dtHireStDayArray[i], dtHireEdDayArray[i], ref stDate, ref edDate);
+                    stDate = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.StartDate]);
+                    edDate = CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.CompDate]);
+                    CreateLedgerSQL.CalcStartCompDate((int)numUDConstPro.Value,
+                                        dtDefaultStart, dtDefaultEnd,
+                                        CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.HireStartDays]),
+                                        CommonMotions.cnvDate(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.HireCompDays]),
+                                        ref stDate, ref edDate);
 
                     // ‹‹—^—Ý�ÏŽæ“¾
-                    int workSalary = CommonMotions.CalcElapsedSalary(SalaryDB, stDate, edDate, PersonCDArray[i]);
+                    int workSalary = CommonMotions.CalcElapsedSalary(SalaryDB, stDate, edDate,
+                                                                        CommonMotions.cnvInt(ObjRec[(int)CreateLedgerSQL.GetPersonTerm.PersonCode]));
                     // —ÝŒv‰ÁŽZ
                     TotalSalary += workSalary;
 
@@ -1764,7 +1215,7 @@
 
                 // ----- •\Ž¦�ˆ—�
                 // �U•ª‹‹—^‹àŠz�E�ƒ—˜‰v‹àŠz�E‘e—˜‰v‹àŠzŽæ“¾
-                ProfitGeneral(DepartmentCode, 0, ref OnSalary, ref  NetIncome, ref  NonSalary);
+                CreateLedgerSQL.ProfitGeneral(LedgerDB, (int)numUDConstPro.Value, DepartmentCode, 0, ref OnSalary);
 
                 // �U•ª‹‹—^‹àŠz•\Ž¦
                 lblCalcValue1.Text = OnSalary.ToString("#,0");
Index: branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Request/SalesConfirm/FrmSalesConfirmAuxiliary.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Request/SalesConfirm/FrmSalesConfirmAuxiliary.cs	(revision 260)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Request/SalesConfirm/FrmSalesConfirmAuxiliary.cs	(revision 261)
@@ -459,7 +459,7 @@
                 sql.Append(" from requesthead AS A1");
                 sql.Append(" LEFT JOIN orderersmaster AS A2 ON A2.OrderCotegory = A1.ORDERERSDIVISION AND A2.OrderersCode = A1.ORDERERSCODE");
                 sql.AppendFormat(" LEFT JOIN divisionmaster AS Divi ON Divi.DivisionCode = {0} And Divi.NameCode = A2.OrderCotegory",
-                                    (int)CommonDefine.DivisionMasterCodeDefine.OrderDivision);
+                                    (int)DivisionMaster.DivisionMasterCodeDefine.OrderDivision);
 
                 sql.Append(", constructionbaseinfo AS C1");
                 sql.AppendFormat(" LEFT JOIN constructionbaseinfodetail C2 ON C2.ConstructionCode = C1.ConstructionCode AND C2.DetailNo= {0}",
Index: branches/src/ProcessManagement/ProcessManagement/Forms/Master/ConstructionType/FrmConstructionType.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/Master/ConstructionType/FrmConstructionType.cs	(revision 260)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/Master/ConstructionType/FrmConstructionType.cs	(revision 261)
@@ -1084,7 +1084,7 @@
                 dgvExpenses.Rows.Clear();
 
                 // å·¥äº‹ç¨®åˆ¥çµŒè²»çŽ‡ãƒžã‚¹ã‚¿å�–å¾—
-                int DivCode = CommonDefine.DivisionMasterCode.First(x => x.Value.Equals("å·¥äº‹çµŒè²»å��ç§°ç™»éŒ²")).Key;
+                int DivCode = DivisionMaster.DivisionMasterCode.First(x => x.Value.Equals("å·¥äº‹çµŒè²»å��ç§°ç™»éŒ²")).Key;
                 ArrayList wrklist = new ArrayList();
                 string strSQL = "SELECT A.NAMECODE, A.NAMESTRING, B.TYPECODE, B.EXPENSESPERIOD, B.EXPENSESRAITO";
                 strSQL += " FROM DIVISIONMASTER A";
Index: branches/src/ProcessManagement/ProcessManagement/Forms/Master/Department/FrmDepartment.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/Master/Department/FrmDepartment.cs	(revision 260)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/Master/Department/FrmDepartment.cs	(revision 261)
@@ -982,7 +982,7 @@
                 strSQL += string.Format(" WHERE DEPARTMENTCODE = {0}) B", m_DepartmentCode);
                 strSQL += " ON A.NAMECODE = B.NAMECODE";
                 strSQL += string.Format(" AND B.EXPENSESPERIOD = {0}", CommonMotions.cnvInt(numUDPeriod.Value));
-                strSQL += string.Format(" WHERE A.DIVISIONCODE = {0}", (int)CommonDefine.DivisionMasterCodeDefine.ConstructionExpenses);
+                strSQL += string.Format(" WHERE A.DIVISIONCODE = {0}", (int)DivisionMaster.DivisionMasterCodeDefine.ConstructionExpenses);
                 strSQL += " ORDER BY A.DISPLAYORDER";
                 ArrayList arData = new ArrayList();
                 expDB.ExecuteReader(strSQL, ref arData);
Index: branches/src/ProcessManagement/ProcessManagement/Forms/Master/Division/FrmDivisionMaster.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/Master/Division/FrmDivisionMaster.cs	(revision 260)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/Master/Division/FrmDivisionMaster.cs	(revision 261)
@@ -613,10 +613,10 @@
 
                 // ã‚¿ã‚¤ãƒˆãƒ«ã‚»ãƒƒãƒˆ
                 lblTitle.Text = "";
-                for (int i = 0; i < CommonDefine.DivisionMasterCode[m_DivisionCode].Length; i++)
+                for (int i = 0; i < DivisionMaster.DivisionMasterCode[m_DivisionCode].Length; i++)
                 {
                     if (i != 0) lblTitle.Text += "ã€€";
-                    lblTitle.Text += CommonDefine.DivisionMasterCode[m_DivisionCode].Substring(i, 1);
+                    lblTitle.Text += DivisionMaster.DivisionMasterCode[m_DivisionCode].Substring(i, 1);
                 }
 
                 // åˆ�æœŸæ™‚ãƒ•ãƒ©ã‚°
Index: branches/src/ProcessManagement/ProcessManagement/Forms/Master/Expenses/FrmExpenses.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/Master/Expenses/FrmExpenses.cs	(revision 260)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/Master/Expenses/FrmExpenses.cs	(revision 261)
@@ -629,8 +629,8 @@
 
                 // çµŒè²»çŽ‡ãƒžã‚¹ã‚¿å�–å¾—
                 // Valueã�‹ã‚‰Keyã‚’æ¤œç´¢
-                int DivisionCode = (int)CommonDefine.DivisionMasterCodeDefine.ConstructionClass;
-                int KeihirituCode = (int)CommonDefine.DivisionMasterCodeDefine.ConstructionExpenses;
+                int DivisionCode = (int)DivisionMaster.DivisionMasterCodeDefine.ConstructionClass;
+                int KeihirituCode = (int)DivisionMaster.DivisionMasterCodeDefine.ConstructionExpenses;
 
                 string strSQL = "Select";
                 strSQL += " A.NameCode,";
Index: branches/src/ProcessManagement/ProcessManagement/Forms/Master/Orderer/FrmOrderers.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/Master/Orderer/FrmOrderers.cs	(revision 260)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/Master/Orderer/FrmOrderers.cs	(revision 261)
@@ -1247,7 +1247,7 @@
                 // Valueã�‹ã‚‰Keyã‚’æ¤œç´¢
                 //string DivisionName = CommonDefine.DivisionMasterCode[1];
                 //int DivisionCode = CommonDefine.DivisionMasterCode.First(x => x.Value == DivisionName).Key;
-                int DivisionCode = (int)CommonDefine.DivisionMasterCodeDefine.OrderDivision;
+                int DivisionCode = (int)DivisionMaster.DivisionMasterCodeDefine.OrderDivision;
                 string strSQL = dvDB.CreatePrimarykeyString(DivisionCode) + " And DeleteFlg = 0 ORDER BY DISPLAYORDER";
                 if (!dvDB.SelectAction(strSQL, ref bvList)) return;
                 if (bvList.Count == 0) return;
Index: branches/src/ProcessManagement/ProcessManagement/Forms/ZMenu/FrmMenu.Designer.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/ZMenu/FrmMenu.Designer.cs	(revision 260)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/ZMenu/FrmMenu.Designer.cs	(revision 261)
@@ -4860,6 +4860,7 @@
             this.chartSalesGraph.Size = new System.Drawing.Size(1190, 444);
             this.chartSalesGraph.TabIndex = 0;
             this.chartSalesGraph.Text = "å£²ä¸Šã‚°ãƒ©ãƒ•";
+            this.chartSalesGraph.GetToolTipText += new System.EventHandler<System.Windows.Forms.DataVisualization.Charting.ToolTipEventArgs>(this.chartSalesGraph_GetToolTipText);
             // 
             // label24
             // 
Index: branches/src/ProcessManagement/ProcessManagement/Forms/ZMenu/FrmMenu.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/ZMenu/FrmMenu.cs	(revision 260)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/ZMenu/FrmMenu.cs	(revision 261)
@@ -2603,5 +2603,26 @@
         }
         #endregion
 
+        #region æ‰“ã�¡ä¸Šã�’ã‚°ãƒ©ãƒ•ãƒ„ãƒ¼ãƒ«ãƒ�ãƒƒãƒ—
+        /// <summary>
+        /// æ‰“ã�¡ä¸Šã�’ã‚°ãƒ©ãƒ•ãƒ„ãƒ¼ãƒ«ãƒ�ãƒƒãƒ—
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void chartSalesGraph_GetToolTipText(object sender, ToolTipEventArgs e)
+        {
+            // ä¸Šé•·ã�¯é‡‘é¡�ã�Œè¦‹ã�ˆã‚‹
+            int NRank = (int)CommonDefine.SecurityRankPos.NormalAuthority;      // ä¸€èˆ¬è€…ã‚¢ã‚¯ã‚»ã‚¹
+            if (CommonMotions.LoginUserSecurity.SecRank == CommonDefine.SecurityRankList[NRank].Key) return;
+
+            // ãƒ‡ãƒ¼ã‚¿ãƒ�ã‚¤ãƒ³ãƒˆã�«è¡¨ç¤ºã�™ã‚‹
+            if (e.HitTestResult.ChartElementType == ChartElementType.DataPoint)
+            {
+                int i = e.HitTestResult.PointIndex;
+                DataPoint dp = e.HitTestResult.Series.Points[i];
+                e.Text = String.Format("{0} : {1}", e.HitTestResult.Series.Name, dp.YValues[0].ToString("#,0"));
+            }
+        }
+        #endregion
     }
 }
Index: branches/src/ProcessManagement/ProcessManagement/Forms/ZMenu/FrmMenuAuxiliary.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Forms/ZMenu/FrmMenuAuxiliary.cs	(revision 260)
+++ branches/src/ProcessManagement/ProcessManagement/Forms/ZMenu/FrmMenuAuxiliary.cs	(revision 261)
@@ -5133,6 +5133,150 @@
         }
         #endregion
 
+        #region ã‚°ãƒ©ãƒ•ãƒ‡ãƒ¼ã‚¿å�–å¾—SQLä½œæˆ�
+        /// <summary>
+        /// ã‚°ãƒ©ãƒ•ãƒ‡ãƒ¼ã‚¿å�–å¾—SQLä½œæˆ�
+        /// </summary>
+        /// <param name="strSQL"></param>
+        private void CreateGraphDataSQL(ref StringBuilder strSQL)
+        {
+            try
+            {
+                strSQL.Append("Select");
+                strSQL.Append(" Dep.DepartmentCode AS DepartmentCode");             // 0
+                strSQL.Append(", Dep.DepartmentString AS DepName");                 // 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)");           // 9
+                strSQL.Append(", '%Y/%m/%d') AS ReqDate");
+                strSQL.Append(", DATE_FORMAT(MAX(Ledger.UPDATEDATE)");              // 10
+                strSQL.Append(", '%Y/%m/%d') AS LedgerDate");
+                strSQL.Append(", SUM(Ledger.OrdersDecisionPrice) As OrderVal");     // 11
+
+                strSQL.Append(" From");
+                strSQL.Append(" departmentmaster AS Dep");
+                strSQL.Append(" LEFT JOIN personinchargemaster AS Person ON Person.DepartmentCode = Dep.DepartmentCode");
+                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");
+                strSubSQL.Append(" F.DepartmentCode AS DepartmentCode");
+                strSubSQL.Append(" , F.DepartmentString AS DepName");
+                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.AppendFormat(" And D.ConstructionCode = B.ConstructionCode");
+                strSubSQL.AppendFormat(" And F.DepartmentCode = A.DepartmentCode");
+                strSubSQL.AppendFormat(" Group By F.DepartmentCode");
+                strSubSQL.AppendFormat(") AS ReqDetail");
+
+                strSQL.Append(strSubSQL.ToString());
+
+                strSQL.AppendFormat(" WHERE Constr.ConstructionPeriod = {0}", SalseGraphNum.Value);
+                strSQL.Append(" And ReqDetail.DepartmentCode = Dep.DepartmentCode");
+                strSQL.AppendFormat(" And Person.LEDGERFLG = {0}", (int)CommonDefine.PersonLedgerDivNo.CalcTarget);
+
+                strSQL.Append(" Group By Dep.DepartmentCode");
+                strSQL.Append(" Order By Dep.DisplayOrder");
+            }
+            catch (Exception ex)
+            {
+                logger.ErrorFormat("ã‚·ã‚¹ãƒ†ãƒ ã‚¨ãƒ©ãƒ¼ï¼š{0}ï¼š{1}", CommonMotions.GetMethodName(), ex.Message);
+            }
+        }
+        #endregion
+
+        #region ç�¾è¡Œå‡¦ç�†ãƒ‡ãƒ¼ã‚¿ã�®è¨­å®š
+        ///// <summary>
+        ///// ãƒ‡ãƒ¼ã‚¿ã�®è¨­å®š
+        ///// </summary>
+        ///// <returns></returns>
+        //private DataSet GetData()
+        //{
+        //    DataSet ds = new DataSet();
+        //    DataTable dt = new DataTable();
+        //    DataRow dtRow;
+
+        //    IOSalesGraphData sgdDB = new IOSalesGraphData();
+        //    List<SalesGraphData> sgdList = new List<SalesGraphData>();
+        //    try
+        //    {
+
+        //        // åˆ—ã�®ä½œæˆ�
+        //        dt.Columns.Add("å¯¾è±¡å��", Type.GetType("System.String"));
+        //        dt.Columns.Add("å£²ä¸Š", Type.GetType("System.Int32"));
+        //        dt.Columns.Add("è²©ç®¡ãƒ»éƒ¨ç½²çµŒè²»", Type.GetType("System.Int32"));
+        //        dt.Columns.Add("ç²—åˆ©ç›Š", Type.GetType("System.Int32"));
+        //        dt.Columns.Add("ç´”åˆ©ç›Šï¼ˆæ��ç›Šï¼‰", Type.GetType("System.Int32"));
+        //        ds.Tables.Add(dt);
+
+        //        // SQLä½œæˆ�
+        //        string strSQL = string.Format(" WHERE ConstructionPeriod = {0} Order By DisplayOrder ASC", SalseGraphNum.Value);
+        //        // è¡¨ç¤ºé †ãƒžã‚¹ã‚¿å�–å¾—
+        //        if (!sgdDB.SelectAction(strSQL, ref sgdList)) return ds;
+
+        //        int ino = 0;
+        //        progBarSalesGraph.Visible = true;
+        //        progBarSalesGraph.Minimum = ino;
+        //        progBarSalesGraph.Maximum = sgdList.Count;
+        //        tabPage14.Update();
+
+        //        DateTime wrkUpdate = sgdList[0].UpdateDate;
+        //        foreach (SalesGraphData wrkRec in sgdList)
+        //        {
+        //            // ãƒ‡ãƒ¼ã‚¿ã�®è¿½åŠ 
+        //            dtRow = ds.Tables[0].NewRow();
+        //            dtRow[0] = wrkRec.DataName;
+        //            dtRow[1] = wrkRec.SalesAmount.ToString();
+        //            dtRow[2] = wrkRec.AdministrativeExpense.ToString();
+        //            dtRow[3] = wrkRec.GrossProfit.ToString();
+        //            dtRow[4] = wrkRec.NetIncome.ToString();
+        //            ds.Tables[0].Rows.Add(dtRow);
+
+        //            // 1ç•ªå¤§ã��ã�„æ›´æ–°å€¤ã‚’å�–ã‚‹
+        //            if (wrkUpdate < wrkRec.UpdateDate) wrkUpdate = wrkRec.UpdateDate;
+
+        //            // ProgressBarã�®å€¤ã‚’å¤‰æ›´ã�™ã‚‹
+        //            progBarSalesGraph.Value = ino++;
+        //            progBarSalesGraph.Update();
+        //        }
+
+        //        // ProgressBarã�®å€¤ã‚’å¤‰æ›´ã�™ã‚‹
+        //        progBarSalesGraph.Value = progBarSalesGraph.Maximum;
+        //        progBarSalesGraph.Update();
+        //        progBarSalesGraph.Visible = false;
+
+        //        // æ›´æ–°æ—¥æ™‚ã‚’è¡¨ç¤ºã�™ã‚‹
+        //        lblSalesGraphUpdate.Text = wrkUpdate.ToString("yyyyå¹´MMæœˆddæ—¥ tthhæ™‚mmåˆ† ") + "ç�¾åœ¨";
+        //    }
+        //    catch (Exception ex)
+        //    {
+        //        logger.ErrorFormat("ã‚·ã‚¹ãƒ†ãƒ ã‚¨ãƒ©ãƒ¼ï¼š{0}ï¼š{1}", CommonMotions.GetMethodName(), ex.Message);
+        //    }
+        //    finally
+        //    {
+        //        sgdDB.close(); sgdDB = null;
+        //    }
+
+        //    return ds;
+        //}
+        #endregion
+
         #region ãƒ‡ãƒ¼ã‚¿ã�®è¨­å®š
         /// <summary>
         /// ãƒ‡ãƒ¼ã‚¿ã�®è¨­å®š
@@ -5144,44 +5288,83 @@
             DataTable dt = new DataTable();
             DataRow dtRow;
 
-            IOSalesGraphData sgdDB = new IOSalesGraphData();
-            List<SalesGraphData> sgdList = new List<SalesGraphData>();
+            IORequestDataDetail ReqDB = new IORequestDataDetail();
+            IOMPersonInCharge PersonDB = new IOMPersonInCharge();
+            IOCostDataOfPerson CostDB = new IOCostDataOfPerson();
             try
             {
-
                 // åˆ—ã�®ä½œæˆ�
                 dt.Columns.Add("å¯¾è±¡å��", Type.GetType("System.String"));
-                dt.Columns.Add("å£²ä¸Š", Type.GetType("System.Int32"));
-                dt.Columns.Add("è²©ç®¡ãƒ»éƒ¨ç½²çµŒè²»", Type.GetType("System.Int32"));
-                dt.Columns.Add("ç²—åˆ©ç›Š", Type.GetType("System.Int32"));
-                dt.Columns.Add("ç´”åˆ©ç›Šï¼ˆæ��ç›Šï¼‰", Type.GetType("System.Int32"));
+                dt.Columns.Add("å�—æ³¨é‡‘é¡�", Type.GetType("System.Int64"));
+                dt.Columns.Add("å£²ä¸Šé‡‘é¡�", Type.GetType("System.Int64"));
+                dt.Columns.Add("ä¼šç¤¾çµŒè²»", Type.GetType("System.Int64"));
+                dt.Columns.Add("éƒ¨ç½²çµŒè²»", Type.GetType("System.Int64"));
+                dt.Columns.Add("å–¶æ¥­çµŒè²»", Type.GetType("System.Int64"));
+                dt.Columns.Add("ç²—åˆ©ç›Š", Type.GetType("System.Int64"));
+                dt.Columns.Add("ç´”åˆ©ç›Šï¼ˆæ��ç›Šï¼‰", Type.GetType("System.Int64"));
                 ds.Tables.Add(dt);
 
                 // SQLä½œæˆ�
-                string strSQL = string.Format(" WHERE ConstructionPeriod = {0} Order By DisplayOrder ASC", SalseGraphNum.Value);
-                // è¡¨ç¤ºé †ãƒžã‚¹ã‚¿å�–å¾—
-                if (!sgdDB.SelectAction(strSQL, ref sgdList)) return ds;
+                StringBuilder strSQL = new StringBuilder();
+                CreateGraphDataSQL(ref strSQL);
+                ArrayList ArList = new ArrayList();
+                // ãƒ‡ãƒ¼ã‚¿å�–å¾—å�–å¾—
+                if (!ReqDB.ExecuteReader(strSQL.ToString(), ref ArList)) return ds;
 
                 int ino = 0;
                 progBarSalesGraph.Visible = true;
                 progBarSalesGraph.Minimum = ino;
-                progBarSalesGraph.Maximum = sgdList.Count;
+                progBarSalesGraph.Maximum = ArList.Count;
                 tabPage14.Update();
 
-                DateTime wrkUpdate = sgdList[0].UpdateDate;
-                foreach (SalesGraphData wrkRec in sgdList)
+                DateTime dtDefStart = CommonMotions.GetOpeningEndDate((int)SalseGraphNum.Value);
+                DateTime dtDefComp = CommonMotions.GetOpeningEndDate((int)SalseGraphNum.Value, false);
+
+                DateTime wrkUpdate = DateTime.MinValue;
+                int DepCode = 0;
+                long DepSalary = 0;
+                long PaySalary = 0;
+                long CostValue = 0;
+
+                foreach (object[] wrkRec in ArList)
                 {
+                    DepCode = CommonMotions.cnvInt(wrkRec[0]);
+
+                    // éƒ¨ç½²æ¯Žçµ¦ä¸Žï¼ˆæŒ¯åˆ†çµ¦ä¸Žï¼�çµŒé�Žçµ¦ä¸Žï¼‹å‰¯æ‹…å½“çµ¦ä¸Žï¼‹æŒ‡å°Žå“¡çµ¦ä¸Žï¼‰
+                    DepSalary = CalcDepSalary(PersonDB, DepCode, dtDefStart, dtDefComp);
+
+                    // æ”¯æ‰•äººä»¶è²»ï¼ˆä»–éƒ¨ç½²å‰¯æ‹…å½“çµ¦ä¸Žï¼‹ä»–éƒ¨ç½²æŒ‡å°Žå“¡çµ¦ä¸Žï¼‰
+                    PaySalary = CalcPaySalary(PersonDB, DepCode);
+                    
+                    // çµŒè²»å�–å¾—
+                    int ArrayCount = Common.CommonDefine.CostDataNoString.Length;
+                    int[] CostArray = new int[ArrayCount];
+                    CreateLedgerSQL.GetPersonExpensesCostValue(CostDB, DepCode, 0, dtDefStart, dtDefComp, ref CostArray);
+                    CostValue = CostArray.Sum();
+
                     // ãƒ‡ãƒ¼ã‚¿ã�®è¿½åŠ 
                     dtRow = ds.Tables[0].NewRow();
-                    dtRow[0] = wrkRec.DataName;
-                    dtRow[1] = wrkRec.SalesAmount.ToString();
-                    dtRow[2] = wrkRec.AdministrativeExpense.ToString();
-                    dtRow[3] = wrkRec.GrossProfit.ToString();
-                    dtRow[4] = wrkRec.NetIncome.ToString();
+                    // éƒ¨ç½²å��
+                    dtRow[0] = CommonMotions.cnvString(wrkRec[1]);
+                    // å�—æ³¨é‡‘é¡�
+                    dtRow[1] = CommonMotions.cnvLong(wrkRec[11]);
+                    // è«‹æ±‚é‡‘é¡�
+                    dtRow[2] = CommonMotions.cnvLong(wrkRec[2]);
+                    // ä¼šç¤¾çµŒè²»
+                    dtRow[3] = CommonMotions.cnvLong(wrkRec[3]);
+                    // éƒ¨ç½²çµŒè²»
+                    dtRow[4] = CommonMotions.cnvLong(wrkRec[4]);
+                    // å–¶æ¥­ç®¡ç�†è²»
+                    dtRow[5] = CommonMotions.cnvLong(wrkRec[5]);
+                    // ç²—åˆ©ç›Šï¼ˆå£²ä¸Šï¼�ç·�æ”¯æ‰•é¡�ï¼�çµŒè²»ï¼‰
+                    dtRow[6] = CommonMotions.cnvLong(wrkRec[2]) - CommonMotions.cnvLong(wrkRec[6]) - CostValue;
+                    // ç´”åˆ©ç›Šï¼ˆå£²ä¸Šï¼�ç·�æ”¯æ‰•é¡�ï¼�çµŒè²»ï¼�æ”¯æ‰•äººä»¶è²»ï¼‹éƒ¨ç½²çµ¦ä¸Žå·®é¡�ï¼‰
+                    dtRow[7] = (CommonMotions.cnvLong(wrkRec[2]) - CommonMotions.cnvLong(wrkRec[6]) - CostValue) - PaySalary + DepSalary;
                     ds.Tables[0].Rows.Add(dtRow);
 
                     // 1ç•ªå¤§ã��ã�„æ›´æ–°å€¤ã‚’å�–ã‚‹
-                    if (wrkUpdate < wrkRec.UpdateDate) wrkUpdate = wrkRec.UpdateDate;
+                    if (wrkUpdate < CommonMotions.cnvDate(wrkRec[9])) wrkUpdate = CommonMotions.cnvDate(wrkRec[9]);
+                    if (wrkUpdate < CommonMotions.cnvDate(wrkRec[10])) wrkUpdate = CommonMotions.cnvDate(wrkRec[10]);
 
                     // ProgressBarã�®å€¤ã‚’å¤‰æ›´ã�™ã‚‹
                     progBarSalesGraph.Value = ino++;
@@ -5194,7 +5377,8 @@
                 progBarSalesGraph.Visible = false;
 
                 // æ›´æ–°æ—¥æ™‚ã‚’è¡¨ç¤ºã�™ã‚‹
-                lblSalesGraphUpdate.Text = wrkUpdate.ToString("yyyyå¹´MMæœˆddæ—¥ tthhæ™‚mmåˆ† ") + "ç�¾åœ¨";
+                //lblSalesGraphUpdate.Text = wrkUpdate.ToString("yyyyå¹´MMæœˆddæ—¥ tthhæ™‚mmåˆ† ") + "ç�¾åœ¨";
+                lblSalesGraphUpdate.Text = string.Format("{0} ç�¾åœ¨",wrkUpdate.ToString("yyyyå¹´MMæœˆddæ—¥"));
             }
             catch (Exception ex)
             {
@@ -5202,7 +5386,9 @@
             }
             finally
             {
-                sgdDB.close(); sgdDB = null;
+                ReqDB.close(); ReqDB = null;
+                PersonDB.close(); PersonDB = null;
+                CostDB.close(); CostDB = null;
             }
 
             return ds;
@@ -5209,6 +5395,307 @@
         }
         #endregion
 
+        #region çµ¦ä¸Žé‡‘é¡�é…�åˆ—ä½�ç½®
+        /// <summary>
+        /// çµ¦ä¸Žé‡‘é¡�é…�åˆ—ä½�ç½®
+        /// </summary>
+        private enum SalVal
+        {
+            Payroll = 0,
+            Assistant,
+            Instructor,
+        }
+        #endregion
+        
+        #region æ”¯æ‰•äººä»¶è²»å�–å¾—
+        /// <summary>
+        /// æ”¯æ‰•äººä»¶è²»å�–å¾—
+        /// </summary>
+        /// <returns></returns>
+        private long CalcPaySalary(IOMPersonInCharge PersonDB, int DepartmentCode)
+        {
+            try
+            {
+                StringBuilder strSQL = new StringBuilder();
+                // å�–å¾—ï¼³ï¼±ï¼¬ä½œæˆ�
+                strSQL.Append("Select SUM(C.PaymentAmount) From");
+                strSQL.Append(" constructionbaseinfo AS A");
+                strSQL.Append(", constructionledgerdetail AS B");
+                strSQL.Append(" LEFT JOIN constructionledgerexcute AS C");
+                strSQL.Append(" ON C.ConstructionCode = B.ConstructionCode");
+                strSQL.Append(" And C.GroupCount = B.GroupCount");
+                strSQL.Append(" And C.LineCount = B.LineCount");
+                strSQL.Append(" Where A.ConstructionPersonCode IN (");
+                strSQL.Append(" SELECT APerson.PERSONCODE FROM personinchargemaster As APerson");
+                strSQL.AppendFormat(" Where APerson.DepartmentCode = {0})", DepartmentCode);
+                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 CalcDepSalary(IOMPersonInCharge PersonDB, int DepartmentCode, DateTime dtDefStart, DateTime dtDefComp)
+        {
+            try
+            {
+                StringBuilder strSQL = new StringBuilder();
+                // å�–å¾—ï¼³ï¼±ï¼¬ä½œæˆ�
+                CreateDepSalarySQL(DepartmentCode, ref strSQL, dtDefStart, dtDefComp);
+                // éƒ¨å†…å¯¾è±¡å�–å¾—
+                ArrayList ArList = new ArrayList();
+                PersonDB.ExecuteReader(strSQL.ToString(), ref ArList);
+
+                int DepCode = 0;
+                int PersonCode = 0;
+                int TotalSalary = 0;
+                DateTime dtStart = DateTime.Today;
+                DateTime dtComp = DateTime.Today;
+                DateTime dtInTime = DateTime.Today;
+                DateTime dtOutTime = DateTime.Today;
+                foreach (object[] objRec in ArList)
+                {
+                    DepCode = CommonMotions.cnvInt(objRec[0]);
+                    PersonCode = 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.SystemMasterData.BusinessPeriod) dtComp = dtDefComp;
+                    // é€€ç¤¾æ—¥ã�Œè©²å½“ç¯„å›²å†…ã�ªã‚‰ã�°å¤‰æ›´
+                    if (dtDefStart <= dtOutTime && dtOutTime <= dtDefComp) dtComp = dtOutTime;
+
+                    // çµŒé�Žçµ¦ä¸Žå�–å¾—
+                    TotalSalary += CommonMotions.CalcElapsedSalary(PersonDB, dtStart, dtComp, PersonCode);
+                }
+
+                // æŒ¯åˆ†åˆ†ã�®å�–å¾—
+                int getCnt = Enum.GetNames(typeof(SalVal)).Length;
+                long[] SVal = new long[getCnt];
+                GetSalaryValue(PersonDB, DepartmentCode, ref SVal);
+
+                return (TotalSalary * -1) + (SVal[(int)SalVal.Assistant] + SVal[(int)SalVal.Instructor]);
+            }
+            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, 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(", Case When");
+                //strSQL.AppendFormat(" DATE(Base.CONSTRUCTIONPERIODSTART) != DATE('{0}')", DateTime.MinValue.ToShortDateString());
+                //strSQL.AppendFormat(" AND DATE(Base.CONSTRUCTIONPERIODSTART2) != DATE('{0}') Then", DateTime.MinValue.ToShortDateString());
+                //strSQL.Append(" Case When");
+                //strSQL.Append(" Base.CONSTRUCTIONPERIODSTART <= Base.CONSTRUCTIONPERIODSTART2 Then Base.CONSTRUCTIONPERIODSTART");
+                //strSQL.Append(" Else Base.CONSTRUCTIONPERIODSTART2");
+                //strSQL.Append(" End");
+                //strSQL.Append(" Else Base.CONSTRUCTIONPERIODSTART");
+                //strSQL.Append(" End As Start0");
+                //strSQL.Append(", Case When");
+                //strSQL.AppendFormat(" DATE(Base.CONSTRUCTIONPERIODEND) != DATE('{0}')", DateTime.MinValue.ToShortDateString());
+                //strSQL.AppendFormat(" AND DATE(Base.CONSTRUCTIONPERIODEND2) != DATE('{0}')", DateTime.MinValue.ToShortDateString());
+                //strSQL.Append(" Then Case When Base.CONSTRUCTIONPERIODEND >= Base.CONSTRUCTIONPERIODEND2 Then Base.CONSTRUCTIONPERIODEND");
+                //strSQL.Append(" Else Base.CONSTRUCTIONPERIODEND2");
+                //strSQL.Append(" End");
+                //strSQL.Append(" Else Base.CONSTRUCTIONPERIODEND");
+                //strSQL.Append(" End 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);
+                strSQL.AppendFormat(" And Person.LEDGERFLG = {0}", (int)CommonDefine.PersonLedgerDivNo.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, ref long[] lVal)
+        {
+            try
+            {
+                StringBuilder strSQL = new StringBuilder();
+                // å�–å¾—ï¼³ï¼±ï¼¬ä½œæˆ�
+                CreateSalaryValSQL(DepartmentCode, 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, 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 constructionledgerexcute 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);
+                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>
         /// æœŸã�®æœ€å¤§ãƒ»æœ€å°‘ã‚’ã‚»ãƒƒãƒˆã�™ã‚‹ï¼ˆå£²ä¸Šã‚°ãƒ©ãƒ•ï¼‰
Index: branches/src/ProcessManagement/ProcessManagement/ProcessManagement.csproj
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/ProcessManagement.csproj	(revision 260)
+++ branches/src/ProcessManagement/ProcessManagement/ProcessManagement.csproj	(revision 261)
@@ -290,6 +290,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\ConstructionSplit\FrmConstructionSplitAuxiliary.cs">
       <SubType>Form</SubType>
     </Compile>
Index: branches/src/ProcessManagement/ProcessManagement/Properties/AssemblyInfo.cs
===================================================================
--- branches/src/ProcessManagement/ProcessManagement/Properties/AssemblyInfo.cs	(revision 260)
+++ branches/src/ProcessManagement/ProcessManagement/Properties/AssemblyInfo.cs	(revision 261)
@@ -32,7 +32,7 @@
 // ã�™ã�¹ã�¦ã�®å€¤ã‚’æŒ‡å®šã�™ã‚‹ã�‹ã€�ä¸‹ã�®ã‚ˆã�†ã�« '*' ã‚’ä½¿ã�£ã�¦ãƒ“ãƒ«ãƒ‰ã�Šã‚ˆã�³ãƒªãƒ“ã‚¸ãƒ§ãƒ³ç•ªå�·ã‚’ 
 // æ—¢å®šå€¤ã�«ã�™ã‚‹ã�“ã�¨ã�Œã�§ã��ã�¾ã�™:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.70")]
-[assembly: AssemblyFileVersion("1.0.0.70")]
+[assembly: AssemblyVersion("1.0.0.71")]
+[assembly: AssemblyFileVersion("1.0.0.71")]
 // Log4netã‚’ä½¿ç”¨ã�™ã‚‹
 [assembly: log4net.Config.XmlConfigurator(ConfigFile = @"log4net.config", Watch = true)]
\ No newline at end of file
Index: branches/src/ProcessManagement/ProcessManagement/RequestSheet.xlsx
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
