Index: trunk/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Request/SelectPayment/FrmEntryDeposit.Designer.cs
===================================================================
--- trunk/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Request/SelectPayment/FrmEntryDeposit.Designer.cs	(revision 384)
+++ trunk/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Request/SelectPayment/FrmEntryDeposit.Designer.cs	(revision 385)
@@ -34,7 +34,7 @@
             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();
-            this.dgv1 = new CustomControls.DataGridViewEX();
+            this.dgv1 = new ProcessManagement.Forms.CustomControls.DataGridViewEX();
             this.OrderersDivision = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.OrderersCode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.TargetDate = new System.Windows.Forms.DataGridViewTextBoxColumn();
Index: trunk/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Request/SelectPayment/FrmEntryDeposit.cs
===================================================================
--- trunk/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Request/SelectPayment/FrmEntryDeposit.cs	(revision 384)
+++ trunk/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Request/SelectPayment/FrmEntryDeposit.cs	(revision 385)
@@ -311,7 +311,9 @@
                     }
                     else
                     {
-                        dgv1.Rows[i].Cells[(int)DispColumn.seqNo].Value = i;
+                        var maxSeqNo = Dlist.Max(x => x.seqNo);
+                        Dlist[i].AddEdit = 0;
+                        dgv1.Rows[i].Cells[(int)DispColumn.seqNo].Value = maxSeqNo + 1;
                         dgv1.Rows[i].Cells[(int)DispColumn.depositPersonCode].Value = CommonMotions.LoginUserData.PersonCode;
                         dgv1.Rows[i].Cells[(int)DispColumn.personName].Value = CommonMotions.LoginUserData.SealPrintName;
                         dgv1.Rows[i].Cells[(int)DispColumn.personName].Style.ForeColor = Color.Gray;
@@ -560,8 +562,9 @@
                     {
                         return;
                     }
-                    int seqno = (int)dgv1.Rows[e.RowIndex].Cells[(int)DispColumn.seqNo].Value + 1;
-                    if (seqno == Dlist.Count)
+                    int seqno = (int)dgv1.Rows[e.RowIndex].Cells[(int)DispColumn.seqNo].Value;
+                    int maxSeq = Dlist.Max(x => x.seqNo) + 1;
+                    if (seqno == maxSeq)
                     {
                         Dlist[e.RowIndex].AddEdit = 1;
                         isDirty = true;
@@ -730,8 +733,9 @@
 
                     // 入金日入力済みで入金金額が入力されていない
                     if (!string.IsNullOrEmpty(Dlist[i].depositDate)
-                        && string.IsNullOrEmpty(Dlist[i].depositAmountCash.ToString())
-                        && string.IsNullOrEmpty(Dlist[i].depositAmountBill.ToString()))
+                        && (string.IsNullOrEmpty(Dlist[i].depositAmountCash.ToString()) || Dlist[i].depositAmountCash == 0)
+                        && (string.IsNullOrEmpty(Dlist[i].depositAmountBill.ToString()) || Dlist[i].depositAmountBill == 0)
+                       )
                     {
                         // エラー表示
                         MessageBox.Show("入金日が登録されている行に入金金額が入力されていません。", "登録エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
@@ -739,9 +743,12 @@
                         return;
                     }
                     // 入金金額入力済みで入金日が入力されていない
-                    if (string.IsNullOrEmpty(Dlist[i].depositDate)
-                        && (!string.IsNullOrEmpty(Dlist[i].depositAmountCash.ToString())
-                        || !string.IsNullOrEmpty(Dlist[i].depositAmountBill.ToString())))
+                    if (string.IsNullOrEmpty(Dlist[i].depositDate) &&
+                        (
+                          !(string.IsNullOrEmpty(Dlist[i].depositAmountCash.ToString()) || Dlist[i].depositAmountCash == 0)
+                           || !(string.IsNullOrEmpty(Dlist[i].depositAmountBill.ToString()) || Dlist[i].depositAmountBill == 0)
+                        )
+                       )
                     {
                         // エラー表示
                         MessageBox.Show("入金金額が登録されている行に入金日が入力されていません。", "登録エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
Index: trunk/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Request/SelectPayment/FrmSelectPayment.Designer.cs
===================================================================
--- trunk/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Request/SelectPayment/FrmSelectPayment.Designer.cs	(revision 384)
+++ trunk/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Request/SelectPayment/FrmSelectPayment.Designer.cs	(revision 385)
@@ -42,6 +42,8 @@
             System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
             System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
             System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
             this.label3 = new System.Windows.Forms.Label();
             this.panel1 = new System.Windows.Forms.Panel();
             this.lblRequestAmount = new System.Windows.Forms.Label();
@@ -54,7 +56,12 @@
             this.label2 = new System.Windows.Forms.Label();
             this.btnShow = new System.Windows.Forms.Button();
             this.button1 = new System.Windows.Forms.Button();
+            this.Registration = new System.Windows.Forms.Button();
+            this.btnEnd = new System.Windows.Forms.Button();
+            this.lblCellTotal = new System.Windows.Forms.Label();
+            this.DepositBtn = new System.Windows.Forms.Button();
             this.dgvMaster = new ProcessManagement.Forms.CustomControls.DataGridViewEX();
+            this.KB = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.No = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.RequestMonth = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.RequestNo = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -69,6 +76,7 @@
             this.DepositAmountBill = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.OrderNo = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.DepositAmount = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.TaxAmount = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.DiscountAmount = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.CnstrPrice = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.Fees = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -83,8 +91,6 @@
             this.DepartmentCode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.PersonName = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.NoteDD = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.Registration = new System.Windows.Forms.Button();
-            this.btnEnd = new System.Windows.Forms.Button();
             this.panel1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.dgvMaster)).BeginInit();
             this.SuspendLayout();
@@ -245,9 +251,62 @@
             this.button1.TabIndex = 3;
             this.button1.Text = "・・・";
             this.button1.UseVisualStyleBackColor = true;
-            this.button1.Visible = false;
             this.button1.Click += new System.EventHandler(this.button1_Click);
             // 
+            // Registration
+            // 
+            this.Registration.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+            this.Registration.BackColor = System.Drawing.Color.Green;
+            this.Registration.Font = new System.Drawing.Font("ＭＳ 明朝", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+            this.Registration.ForeColor = System.Drawing.Color.White;
+            this.Registration.Location = new System.Drawing.Point(1071, 585);
+            this.Registration.Name = "Registration";
+            this.Registration.Size = new System.Drawing.Size(120, 30);
+            this.Registration.TabIndex = 6;
+            this.Registration.Text = "登　録";
+            this.Registration.UseVisualStyleBackColor = false;
+            this.Registration.Click += new System.EventHandler(this.Registration_Click);
+            // 
+            // btnEnd
+            // 
+            this.btnEnd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+            this.btnEnd.BackColor = System.Drawing.Color.Blue;
+            this.btnEnd.Font = new System.Drawing.Font("ＭＳ 明朝", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+            this.btnEnd.ForeColor = System.Drawing.Color.White;
+            this.btnEnd.Location = new System.Drawing.Point(1197, 585);
+            this.btnEnd.Name = "btnEnd";
+            this.btnEnd.Size = new System.Drawing.Size(120, 30);
+            this.btnEnd.TabIndex = 7;
+            this.btnEnd.Text = "終　了";
+            this.btnEnd.UseVisualStyleBackColor = false;
+            this.btnEnd.Click += new System.EventHandler(this.btnEnd_Click);
+            // 
+            // lblCellTotal
+            // 
+            this.lblCellTotal.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+            this.lblCellTotal.AutoSize = true;
+            this.lblCellTotal.BackColor = System.Drawing.Color.Black;
+            this.lblCellTotal.Font = new System.Drawing.Font("ＭＳ 明朝", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+            this.lblCellTotal.ForeColor = System.Drawing.Color.White;
+            this.lblCellTotal.Location = new System.Drawing.Point(190, 595);
+            this.lblCellTotal.Name = "lblCellTotal";
+            this.lblCellTotal.Size = new System.Drawing.Size(0, 13);
+            this.lblCellTotal.TabIndex = 31;
+            // 
+            // DepositBtn
+            // 
+            this.DepositBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+            this.DepositBtn.BackColor = System.Drawing.Color.Silver;
+            this.DepositBtn.Font = new System.Drawing.Font("ＭＳ 明朝", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+            this.DepositBtn.ForeColor = System.Drawing.Color.Black;
+            this.DepositBtn.Location = new System.Drawing.Point(856, 585);
+            this.DepositBtn.Name = "DepositBtn";
+            this.DepositBtn.Size = new System.Drawing.Size(120, 30);
+            this.DepositBtn.TabIndex = 32;
+            this.DepositBtn.Text = "入金入力";
+            this.DepositBtn.UseVisualStyleBackColor = false;
+            this.DepositBtn.Click += new System.EventHandler(this.DepositBtn_Click);
+            // 
             // dgvMaster
             // 
             this.dgvMaster.AllowUserToAddRows = false;
@@ -266,6 +325,7 @@
             this.dgvMaster.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
             this.dgvMaster.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
             this.dgvMaster.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
+            this.KB,
             this.No,
             this.RequestMonth,
             this.RequestNo,
@@ -280,6 +340,7 @@
             this.DepositAmountBill,
             this.OrderNo,
             this.DepositAmount,
+            this.TaxAmount,
             this.DiscountAmount,
             this.CnstrPrice,
             this.Fees,
@@ -305,12 +366,23 @@
             this.dgvMaster.CellBeginEdit += new System.Windows.Forms.DataGridViewCellCancelEventHandler(this.dgvMaster_CellBeginEdit);
             this.dgvMaster.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.dgvMaster_CellFormatting);
             this.dgvMaster.CellValidating += new System.Windows.Forms.DataGridViewCellValidatingEventHandler(this.dgvMaster_CellValidating);
+            this.dgvMaster.MouseUp += new System.Windows.Forms.MouseEventHandler(this.DataGridView_MouseUp);
             // 
+            // KB
+            // 
+            dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
+            this.KB.DefaultCellStyle = dataGridViewCellStyle2;
+            this.KB.HeaderText = "行区分";
+            this.KB.Name = "KB";
+            this.KB.ReadOnly = true;
+            this.KB.Resizable = System.Windows.Forms.DataGridViewTriState.False;
+            this.KB.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
+            this.KB.Visible = false;
+            // 
             // No
             // 
-            dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
-            this.No.DefaultCellStyle = dataGridViewCellStyle2;
-            this.No.Frozen = true;
+            dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
+            this.No.DefaultCellStyle = dataGridViewCellStyle3;
             this.No.HeaderText = "No.";
             this.No.Name = "No";
             this.No.ReadOnly = true;
@@ -355,7 +427,6 @@
             // 
             // OrderersName
             // 
-            this.OrderersName.Frozen = true;
             this.OrderersName.HeaderText = "請求先名/請求日";
             this.OrderersName.Name = "OrderersName";
             this.OrderersName.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
@@ -371,7 +442,6 @@
             // 
             // ConstructionName
             // 
-            this.ConstructionName.Frozen = true;
             this.ConstructionName.HeaderText = "現場名";
             this.ConstructionName.Name = "ConstructionName";
             this.ConstructionName.ReadOnly = true;
@@ -380,8 +450,8 @@
             // 
             // BillPrice
             // 
-            dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
-            this.BillPrice.DefaultCellStyle = dataGridViewCellStyle3;
+            dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
+            this.BillPrice.DefaultCellStyle = dataGridViewCellStyle4;
             this.BillPrice.HeaderText = "請求金額\r\n（税抜）";
             this.BillPrice.Name = "BillPrice";
             this.BillPrice.ReadOnly = true;
@@ -391,8 +461,8 @@
             // 
             // TaxPrice
             // 
-            dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
-            this.TaxPrice.DefaultCellStyle = dataGridViewCellStyle4;
+            dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
+            this.TaxPrice.DefaultCellStyle = dataGridViewCellStyle5;
             this.TaxPrice.HeaderText = "請求金額\r\n（消費税）";
             this.TaxPrice.Name = "TaxPrice";
             this.TaxPrice.ReadOnly = true;
@@ -402,8 +472,8 @@
             // 
             // DepositAmountCash
             // 
-            dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
-            this.DepositAmountCash.DefaultCellStyle = dataGridViewCellStyle5;
+            dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
+            this.DepositAmountCash.DefaultCellStyle = dataGridViewCellStyle6;
             this.DepositAmountCash.HeaderText = "入金金額\r\n（振込）";
             this.DepositAmountCash.Name = "DepositAmountCash";
             this.DepositAmountCash.ReadOnly = true;
@@ -413,8 +483,8 @@
             // 
             // DepositAmountBill
             // 
-            dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
-            this.DepositAmountBill.DefaultCellStyle = dataGridViewCellStyle6;
+            dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
+            this.DepositAmountBill.DefaultCellStyle = dataGridViewCellStyle7;
             this.DepositAmountBill.HeaderText = "入金金額\r\n（手形）";
             this.DepositAmountBill.Name = "DepositAmountBill";
             this.DepositAmountBill.ReadOnly = true;
@@ -433,9 +503,9 @@
             // 
             // DepositAmount
             // 
-            dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
-            this.DepositAmount.DefaultCellStyle = dataGridViewCellStyle7;
-            this.DepositAmount.HeaderText = "入金金額";
+            dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
+            this.DepositAmount.DefaultCellStyle = dataGridViewCellStyle8;
+            this.DepositAmount.HeaderText = "入金金額\r\n（税抜）";
             this.DepositAmount.Name = "DepositAmount";
             this.DepositAmount.ReadOnly = true;
             this.DepositAmount.Resizable = System.Windows.Forms.DataGridViewTriState.False;
@@ -442,10 +512,21 @@
             this.DepositAmount.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
             this.DepositAmount.Width = 140;
             // 
+            // TaxAmount
+            // 
+            dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
+            this.TaxAmount.DefaultCellStyle = dataGridViewCellStyle9;
+            this.TaxAmount.HeaderText = "入金金額\r\n（消費税）";
+            this.TaxAmount.Name = "TaxAmount";
+            this.TaxAmount.ReadOnly = true;
+            this.TaxAmount.Resizable = System.Windows.Forms.DataGridViewTriState.False;
+            this.TaxAmount.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
+            this.TaxAmount.Width = 140;
+            // 
             // DiscountAmount
             // 
-            dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
-            this.DiscountAmount.DefaultCellStyle = dataGridViewCellStyle8;
+            dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
+            this.DiscountAmount.DefaultCellStyle = dataGridViewCellStyle10;
             this.DiscountAmount.HeaderText = "値引金額";
             this.DiscountAmount.Name = "DiscountAmount";
             this.DiscountAmount.ReadOnly = true;
@@ -455,8 +536,8 @@
             // 
             // CnstrPrice
             // 
-            dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
-            this.CnstrPrice.DefaultCellStyle = dataGridViewCellStyle9;
+            dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
+            this.CnstrPrice.DefaultCellStyle = dataGridViewCellStyle11;
             this.CnstrPrice.HeaderText = "協力金";
             this.CnstrPrice.Name = "CnstrPrice";
             this.CnstrPrice.ReadOnly = true;
@@ -466,8 +547,8 @@
             // 
             // Fees
             // 
-            dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
-            this.Fees.DefaultCellStyle = dataGridViewCellStyle10;
+            dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
+            this.Fees.DefaultCellStyle = dataGridViewCellStyle12;
             this.Fees.HeaderText = "手数料";
             this.Fees.Name = "Fees";
             this.Fees.ReadOnly = true;
@@ -477,8 +558,8 @@
             // 
             // OtherAdjustments
             // 
-            dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
-            this.OtherAdjustments.DefaultCellStyle = dataGridViewCellStyle11;
+            dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
+            this.OtherAdjustments.DefaultCellStyle = dataGridViewCellStyle13;
             this.OtherAdjustments.HeaderText = "送料";
             this.OtherAdjustments.Name = "OtherAdjustments";
             this.OtherAdjustments.ReadOnly = true;
@@ -488,8 +569,8 @@
             // 
             // CarryAmount
             // 
-            dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
-            this.CarryAmount.DefaultCellStyle = dataGridViewCellStyle12;
+            dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
+            this.CarryAmount.DefaultCellStyle = dataGridViewCellStyle14;
             this.CarryAmount.HeaderText = "差分";
             this.CarryAmount.Name = "CarryAmount";
             this.CarryAmount.ReadOnly = true;
@@ -555,8 +636,8 @@
             // 
             // PersonName
             // 
-            dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
-            this.PersonName.DefaultCellStyle = dataGridViewCellStyle13;
+            dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+            this.PersonName.DefaultCellStyle = dataGridViewCellStyle15;
             this.PersonName.HeaderText = "確認";
             this.PersonName.Name = "PersonName";
             this.PersonName.ReadOnly = true;
@@ -566,8 +647,8 @@
             // 
             // NoteDD
             // 
-            dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
-            this.NoteDD.DefaultCellStyle = dataGridViewCellStyle14;
+            dataGridViewCellStyle16.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
+            this.NoteDD.DefaultCellStyle = dataGridViewCellStyle16;
             this.NoteDD.HeaderText = "備考";
             this.NoteDD.Name = "NoteDD";
             this.NoteDD.ReadOnly = true;
@@ -574,34 +655,6 @@
             this.NoteDD.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
             this.NoteDD.Width = 250;
             // 
-            // Registration
-            // 
-            this.Registration.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
-            this.Registration.BackColor = System.Drawing.Color.Green;
-            this.Registration.Font = new System.Drawing.Font("ＭＳ 明朝", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
-            this.Registration.ForeColor = System.Drawing.Color.White;
-            this.Registration.Location = new System.Drawing.Point(1071, 585);
-            this.Registration.Name = "Registration";
-            this.Registration.Size = new System.Drawing.Size(120, 30);
-            this.Registration.TabIndex = 6;
-            this.Registration.Text = "登　録";
-            this.Registration.UseVisualStyleBackColor = false;
-            this.Registration.Click += new System.EventHandler(this.Registration_Click);
-            // 
-            // btnEnd
-            // 
-            this.btnEnd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
-            this.btnEnd.BackColor = System.Drawing.Color.Blue;
-            this.btnEnd.Font = new System.Drawing.Font("ＭＳ 明朝", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
-            this.btnEnd.ForeColor = System.Drawing.Color.White;
-            this.btnEnd.Location = new System.Drawing.Point(1197, 585);
-            this.btnEnd.Name = "btnEnd";
-            this.btnEnd.Size = new System.Drawing.Size(120, 30);
-            this.btnEnd.TabIndex = 7;
-            this.btnEnd.Text = "終　了";
-            this.btnEnd.UseVisualStyleBackColor = false;
-            this.btnEnd.Click += new System.EventHandler(this.btnEnd_Click);
-            // 
             // FrmSelectPayment
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 15F);
@@ -608,6 +661,8 @@
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.BackColor = System.Drawing.Color.Black;
             this.ClientSize = new System.Drawing.Size(1328, 625);
+            this.Controls.Add(this.DepositBtn);
+            this.Controls.Add(this.lblCellTotal);
             this.Controls.Add(this.btnEnd);
             this.Controls.Add(this.Registration);
             this.Controls.Add(this.button1);
@@ -626,6 +681,7 @@
             this.panel1.ResumeLayout(false);
             ((System.ComponentModel.ISupportInitialize)(this.dgvMaster)).EndInit();
             this.ResumeLayout(false);
+            this.PerformLayout();
 
         }
 
@@ -646,6 +702,9 @@
         private System.Windows.Forms.Label label8;
         private System.Windows.Forms.Label lblRequestAmount;
         private System.Windows.Forms.Label label5;
+        private System.Windows.Forms.Label lblCellTotal;
+        private System.Windows.Forms.Button DepositBtn;
+        private System.Windows.Forms.DataGridViewTextBoxColumn KB;
         private System.Windows.Forms.DataGridViewTextBoxColumn No;
         private System.Windows.Forms.DataGridViewTextBoxColumn RequestMonth;
         private System.Windows.Forms.DataGridViewTextBoxColumn RequestNo;
@@ -660,6 +719,7 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn DepositAmountBill;
         private System.Windows.Forms.DataGridViewTextBoxColumn OrderNo;
         private System.Windows.Forms.DataGridViewTextBoxColumn DepositAmount;
+        private System.Windows.Forms.DataGridViewTextBoxColumn TaxAmount;
         private System.Windows.Forms.DataGridViewTextBoxColumn DiscountAmount;
         private System.Windows.Forms.DataGridViewTextBoxColumn CnstrPrice;
         private System.Windows.Forms.DataGridViewTextBoxColumn Fees;
Index: trunk/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Request/SelectPayment/FrmSelectPayment.cs
===================================================================
--- trunk/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Request/SelectPayment/FrmSelectPayment.cs	(revision 384)
+++ trunk/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Request/SelectPayment/FrmSelectPayment.cs	(revision 385)
@@ -49,7 +49,8 @@
         private enum DispColumn
         {
             // 請求書データ（自動入力）
-            No = 0,                                                             // No.
+            KB = 0,                                                             // ■KB
+            No,                                                             // No.
             RequestMonth,                                                       // ■請求月
             RequestNo,                                                          // ■請求書No.
             OrderersDivision,                                                   // ■発注者区分
@@ -66,7 +67,8 @@
             
             // 入金明細データ（工事担当入力欄）
             OrderNo,                                                            // ■受付番号
-            DepositAmount,                                                      // 入金金額
+            DepositAmount,                                                      // 入金金額（税抜）
+            TaxAmount,                                                          // 入金金額（消費税）
             DiscountAmount,                                                     // 値引金額
             CnstrPrice,                                                         // 協力金
             Fees,                                                               // 手数料
@@ -118,7 +120,8 @@
 
             // 入金明細データ
             OrderNo,                                                            // ■受付番号
-            DepositAmount,                                                      // 入金金額
+            DepositAmount,                                                      // 入金金額（税抜き）
+            TaxAmount,                                                          // 入金金額（消費税）
             DiscountAmount,                                                     // 値引金額
             CnstrPrice,                                                         // 協力金
             Fees,                                                               // 手数料
@@ -140,8 +143,10 @@
         }
         #endregion
 
+        #region 金額最大最小値
         private const long amount_max = 9999999999;             // 金額最大
         private const long amount_min = -9999999999;            // 金額最小
+        #endregion
 
         #endregion
 
@@ -270,6 +275,7 @@
             public long BillPrice;
             public long TaxPrice;
             public long DepositAmount;
+            public long TaxAmount;
             public long DiscountAmount;
             public long CnstrPrice;
             public long Fees;
@@ -389,6 +395,17 @@
 
                 SetGridHeaderColor();
                 DisplayData();
+
+                // 入金入力ができる権限以外は入金入力ボタンを非表示
+                if (CommonMotions.LoginUserData.DepartmentCode == CommonDefine.s_GeneralAffairsDevision ||
+                    m_UserInfo.m_Type == CommonDefine.SecurityRankPos.SpecialAuthority)
+                {
+                    DepositBtn.Visible = true;
+                }
+                else
+                {
+                    DepositBtn.Visible = false;
+                }
             }
             catch (Exception ex)
             {
@@ -396,9 +413,9 @@
             }
             finally
             {
-                dgvMaster.CellDoubleClick += DataGridView_DoubleCellClick;
-                dgvMaster.CellEnter += DataGridView_CellEnter;
-                dgvMaster.CellValueChanged += DataGridView_CellValueChanged;
+                //dgvMaster.CellDoubleClick += DataGridView_DoubleCellClick;
+                //dgvMaster.CellEnter += DataGridView_CellEnter;
+                //dgvMaster.CellValueChanged += DataGridView_CellValueChanged;
 
                 IoDd.close();
                 IoDd = null;
@@ -514,6 +531,56 @@
         }
         #endregion
 
+        #region 入金入力ボタンクリック時のイベント
+        /// <summary>
+        /// 入金入力ボタンクリック時のイベント
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void DepositBtn_Click(object sender, EventArgs e)
+        {
+            dgvMaster.CellDoubleClick -= DataGridView_DoubleCellClick;
+            dgvMaster.CellEnter -= DataGridView_CellEnter;
+            dgvMaster.CellValueChanged -= DataGridView_CellValueChanged;
+            try
+            {
+                var cells = dgvMaster.Rows[dgvMaster.CurrentCell.RowIndex].Cells;
+                var checkTargetMonth = CommonMotions.cnvInt(cells[(int)DispColumn.RequestMonth].Value);
+                // 行インデックスが不正な場合はスルー
+                if (dgvMaster.CurrentCell.RowIndex == -1 || checkTargetMonth == 0)
+                {
+                    return;
+                }
+
+                // 入金入力画面の表示
+                if (CommonMotions.LoginUserData.DepartmentCode == CommonDefine.s_GeneralAffairsDevision ||
+                    m_UserInfo.m_Type == CommonDefine.SecurityRankPos.SpecialAuthority)
+                {
+                    if (isDirty && MessageBox.Show("データに変更があります、登録せずに入金入力を行いますか？", "終了確認", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
+                    {
+                        return;
+                    }
+                    var orderersDiv = CommonMotions.cnvInt(cells[(int)DispColumn.OrderersDivision].Value);
+                    var orderersCode = CommonMotions.cnvInt(cells[(int)DispColumn.OrderersCode].Value);
+                    string reqDate = CommonMotions.cnvInt(cells[(int)DispColumn.RequestMonth].Value).ToString();
+
+                    EntryDeposit(orderersDiv, orderersCode, reqDate);
+                    return;
+                }
+            }
+            catch (Exception ex)
+            {
+                logger.ErrorFormat("システムエラー：{0}：{1}", CommonMotions.GetMethodName(), ex.Message);
+            }
+            finally
+            {
+                dgvMaster.CellDoubleClick += DataGridView_DoubleCellClick;
+                dgvMaster.CellEnter += DataGridView_CellEnter;
+                dgvMaster.CellValueChanged += DataGridView_CellValueChanged;
+            }
+        }
+        #endregion
+
         #region 登録ボタンクリック時のイベント
         /// <summary>
         /// 登録ボタンクリック時のイベント
@@ -560,6 +627,7 @@
                             RequestNo = depositDetail.RequestNo,
                             OrderNo = depositDetail.OrderNo,
                             DepositAmount = depositDetail.DepositAmount,
+                            TaxAmount = depositDetail.TaxAmount,
                             DiscountAmount = depositDetail.DiscountAmount,
                             CnstrPrice = depositDetail.CnstrPrice,
                             Fees = depositDetail.Fees,
@@ -605,7 +673,6 @@
                                     throw new Exception();
                                 }
                             }
-
                         }
                     }
                 }
@@ -651,8 +718,10 @@
             dgvMaster.CellValueChanged -= DataGridView_CellValueChanged;
             try
             {
+                var cells = dgvMaster.Rows[e.RowIndex].Cells;
+                var checkTargetMonth = CommonMotions.cnvInt(cells[(int)DispColumn.RequestMonth].Value);
                 // 行インデックスが不正な場合はスルー
-                if (e.RowIndex == -1)
+                if (e.RowIndex == -1 || checkTargetMonth ==0)
                 {
                     return;
                 }
@@ -661,11 +730,13 @@
                 if (e.ColumnIndex == (int)DispColumn.DepositAmountBill
                     || e.ColumnIndex == (int)DispColumn.DepositAmountCash)
                 {
-                    if (CommonMotions.LoginUserData.DepartmentCode == 4 ||
-                        CommonMotions.LoginUserData.SecCode == 2 ||
+                    if (CommonMotions.LoginUserData.DepartmentCode == CommonDefine.s_GeneralAffairsDevision ||
                         m_UserInfo.m_Type == CommonDefine.SecurityRankPos.SpecialAuthority)
                     {
-                        var cells = dgvMaster.Rows[e.RowIndex].Cells;
+                        if (isDirty && MessageBox.Show("データに変更があります、登録せずに入金入力を行いますか？", "終了確認", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
+                        {
+                            return;
+                        }
                         var orderersDiv = CommonMotions.cnvInt(cells[(int)DispColumn.OrderersDivision].Value);
                         var orderersCode = CommonMotions.cnvInt(cells[(int)DispColumn.OrderersCode].Value);
                         string reqDate = CommonMotions.cnvInt(cells[(int)DispColumn.RequestMonth].Value).ToString();
@@ -681,11 +752,13 @@
                     // エラー表示解除
                     UnsetErrorDisp();
 
-                    var cells = dgvMaster.Rows[e.RowIndex].Cells;
                     // 自分以外のセルは編集不可
-                    if (CommonMotions.cnvInt(dgvMaster[(int)DispColumn.ConfirmationPersonCode, e.RowIndex].Value) != CommonMotions.LoginUserData.PersonCode)
+                    if (m_UserInfo.m_Type != CommonDefine.SecurityRankPos.SpecialAuthority)
                     {
-                        return;
+                        if (CommonMotions.cnvInt(dgvMaster[(int)DispColumn.ConfirmationPersonCode, e.RowIndex].Value) != CommonMotions.LoginUserData.PersonCode)
+                        {
+                            return;
+                        }
                     }
 
                     var depositOrderer = FindDepositOrderer(e.RowIndex);
@@ -829,6 +902,7 @@
             int trow = e.RowIndex;
 
             if ((tcol == (int)DispColumn.DepositAmount) ||
+                (tcol == (int)DispColumn.TaxAmount) ||
                 (tcol == (int)DispColumn.DiscountAmount) ||
                 (tcol == (int)DispColumn.CnstrPrice) ||
                 (tcol == (int)DispColumn.Fees) ||
@@ -872,6 +946,7 @@
             dgvMaster.CellDoubleClick -= DataGridView_DoubleCellClick;
             dgvMaster.CellEnter -= DataGridView_CellEnter;
             dgvMaster.CellValueChanged -= DataGridView_CellValueChanged;
+            bool sumDataCheck = false;
             try
             {
 
@@ -899,6 +974,7 @@
                 var depositOrderer = FindDepositOrderer(key.OrderersDivision, key.OrderersCode);
 
                 if ((e.ColumnIndex == (int)DispColumn.DepositAmount) ||
+                    (e.ColumnIndex == (int)DispColumn.TaxAmount) ||
                     (e.ColumnIndex == (int)DispColumn.DiscountAmount) ||
                     (e.ColumnIndex == (int)DispColumn.CnstrPrice) ||
                     (e.ColumnIndex == (int)DispColumn.Fees) ||
@@ -911,6 +987,7 @@
 
                 // 入金明細金額を編集
                 if (e.ColumnIndex == (int)DispColumn.DepositAmount
+                    || e.ColumnIndex == (int)DispColumn.TaxAmount
                     || e.ColumnIndex == (int)DispColumn.DiscountAmount
                     || e.ColumnIndex == (int)DispColumn.CnstrPrice
                     || e.ColumnIndex == (int)DispColumn.Fees
@@ -925,25 +1002,36 @@
                         case (int)DispColumn.DepositAmount:
                             depositDetail.DepositAmount = amount;
                             bUpdateCarryAmount = true;
+                            sumDataCheck = true;
                             break;
+                        case (int)DispColumn.TaxAmount:
+                            depositDetail.TaxAmount = amount;
+                            bUpdateCarryAmount = true;
+                            sumDataCheck = true;
+                            break;
                         case (int)DispColumn.DiscountAmount:
                             depositDetail.DiscountAmount = amount;
                             bUpdateCarryAmount = true;
+                            sumDataCheck = true;
                             break;
                         case (int)DispColumn.CnstrPrice:
                             depositDetail.CnstrPrice = amount;
                             bUpdateCarryAmount = true;
+                            sumDataCheck = true;
                             break;
                         case (int)DispColumn.Fees:
                             depositDetail.Fees = amount;
                             bUpdateCarryAmount = true;
+                            sumDataCheck = true;
                             break;
                         case (int)DispColumn.OtherAdjustments:
                             depositDetail.OtherAdjustments = amount;
                             bUpdateCarryAmount = true;
+                            sumDataCheck = true;
                             break;
                         case (int)DispColumn.DifferentAmount:
                             depositDetail.DifferenceAmount = amount;
+                            sumDataCheck = true;
                             break;
                     }
                     long RequestAmount = depositDetail.BillPrice + depositDetail.TaxPrice;
@@ -951,7 +1039,7 @@
                     // 繰越金以外を修正した場合、
                     if (bUpdateCarryAmount == true)
                     {
-                        long DepositAmount = depositDetail.DepositAmount + depositDetail.DiscountAmount
+                        long DepositAmount = depositDetail.DepositAmount + depositDetail.TaxAmount + depositDetail.DiscountAmount
                             + depositDetail.CnstrPrice + depositDetail.Fees + depositDetail.OtherAdjustments;
                         depositDetail.DifferenceAmount = DepositAmount - RequestAmount;
                     }
@@ -973,7 +1061,21 @@
                     depositDetail.Editted = true;
                 }
                 var headerIndex = DetectHeaderIndex(e.RowIndex);
-                UpdateDepositOrdererRows(depositOrderer, headerIndex);
+                
+                //編集したカラムの修正
+                UpdateDepositOrdererRows(depositOrderer, e.RowIndex);
+
+                //合計行の修正
+                if (sumDataCheck)
+                {
+                    var sumRowIndex = DetectSumIndex(e.RowIndex);
+                    var depositOrdererSum = new DepositOrderer();
+                    depositOrdererSum.KB = 3;
+                    depositOrdererSum.OrderersCode = depositOrderer.OrderersCode;
+                    depositOrdererSum.OrderersDivision = depositOrderer.OrderersDivision;
+                    depositOrdererSum.RequestMonth = depositOrderer.RequestMonth;
+                    UpdateDepositOrdererRows(depositOrdererSum, sumRowIndex);
+                }
                 dgvMaster.CurrentCell = dgvMaster[e.ColumnIndex, e.RowIndex];
                 isDirty = true;
             }
@@ -1012,8 +1114,18 @@
             var data = new List<DepositOrderer>();
             var no = 1;
 
+            bool sumDataBool = false;
+            bool lastSumDataCheck = false;
+            int invoiceDataCount = invoiceData.Count();
+            int dataCount = 0;
+            var oSumV = new DepositOrderer();
+            var oEmpty = new DepositOrderer();
+
             foreach (var invoice in invoiceData)
             {
+                // 最終行確認用
+                dataCount = dataCount + 1;
+
                 // 請求先情報
                 var o = new DepositOrderer();
                 o.KB = CommonMotions.cnvInt(invoice[(int)GetDataFirst.KB]);
@@ -1022,27 +1134,63 @@
                 o.OrderersDivision = CommonMotions.cnvInt(invoice[(int)GetDataFirst.OrderersDivision]);
                 o.OrderersName = CommonMotions.cnvString(invoice[(int)GetDataFirst.OrderersName]);
 
-                // 表示権限がない場合は次へ
-                if (!CheckOrdererPermission(o))
+                if (o.KB == 1)
                 {
-                    continue;
-                }
+                    // 最終行ではない場合は合計行と空行を挿入する
+                    if (invoiceDataCount != dataCount)
+                    {
+                        if (sumDataBool == true)
+                        {
+                            // 合計行用のデータを追加
+                            data.Add(oSumV);
 
-                if (o.KB == 1)
-                {
+                            // 空行用のデータを追加
+                            data.Add(oEmpty);
+
+                            sumDataBool = false;
+                            lastSumDataCheck = false;
+                        }
+                    }
                     o.No = 0;
                 }
                 else
                 {
+                    if (sumDataBool == false)
+                    {
+                        //合計行用データの作成
+                        var oSum = new DepositOrderer();
+                        var dSum = new Deposit();
+
+                        oSum.KB = 3;
+                        oSum.RequestMonth = m_Select_TargetDate;
+                        oSum.OrderersCode = CommonMotions.cnvInt(invoice[(int)GetDataFirst.OrderersCode]);
+                        oSum.OrderersDivision = CommonMotions.cnvInt(invoice[(int)GetDataFirst.OrderersDivision]);
+                        oSum.Deposits = new List<Deposit>();
+                        dSum.SeqNo = CommonMotions.cnvInt(invoice[(int)GetDataFirst.SeqNoD]);
+                        dSum.DepositDate = CommonMotions.cnvString(invoice[(int)GetDataFirst.DepositDate]);
+                        dSum.DepositAmountCash = CommonMotions.cnvLong(invoice[(int)GetDataFirst.DepositAmountCash]);
+                        dSum.DepositAmountBill = CommonMotions.cnvLong(invoice[(int)GetDataFirst.DepositAmountBill]);
+                        dSum.Note = CommonMotions.cnvString(invoice[(int)GetDataFirst.NoteD]);
+                        oSum.Deposits.Add(dSum);
+                        oSumV = oSum;
+
+                        //空行用のデータの作成
+                        var oEmp = new DepositOrderer();
+                        oEmpty.KB = 4;
+                        oEmp.RequestMonth = m_Select_TargetDate;
+                        oEmp.OrderersCode = CommonMotions.cnvInt(invoice[(int)GetDataFirst.OrderersCode]);
+                        oEmp.OrderersDivision = CommonMotions.cnvInt(invoice[(int)GetDataFirst.OrderersDivision]);
+                        oEmpty = oEmp;
+                        sumDataBool = true;
+                        lastSumDataCheck = true;
+                    }
                     o.No = no;
                     no++;
                 }
-
                 o.Deposits = new List<Deposit>();
                 o.DepositDetails = new List<DepositDetail>();
 
                 // 入金データ情報
-
                 var d = new Deposit();
                 d.SeqNo = CommonMotions.cnvInt(invoice[(int)GetDataFirst.SeqNoD]);
                 d.DepositDate = CommonMotions.cnvString(invoice[(int)GetDataFirst.DepositDate]);
@@ -1066,6 +1214,7 @@
                 dd.BillPrice = CommonMotions.cnvLong(invoice[(int)GetDataFirst.BillPrice]);
                 dd.TaxPrice = CommonMotions.cnvLong(invoice[(int)GetDataFirst.TaxPrice]);
                 dd.DepositAmount = CommonMotions.cnvLong(invoice[(int)GetDataFirst.DepositAmount]);
+                dd.TaxAmount = CommonMotions.cnvLong(invoice[(int)GetDataFirst.TaxAmount]);
                 dd.DiscountAmount = CommonMotions.cnvLong(invoice[(int)GetDataFirst.DiscountAmount]);
                 dd.CnstrPrice = CommonMotions.cnvLong(invoice[(int)GetDataFirst.CnstrPrice]);
                 dd.Fees = CommonMotions.cnvLong(invoice[(int)GetDataFirst.Fees]);
@@ -1083,7 +1232,8 @@
                 dd.ConstrSubPersonCode = CommonMotions.cnvInt(invoice[(int)GetDataFirst.ConstrSubPersonCode]);
                 dd.ConstructionInstructor = CommonMotions.cnvInt(invoice[(int)GetDataFirst.ConstructionInstructor]);
 
-                dd.Visible = CheckPermission(dd.DepartmentCode, dd.ConstructionPersonCode, dd.ConstrSubPersonCode, dd.ConstructionInstructor);
+                //dd.Visible = CheckPermission(dd.DepartmentCode, dd.ConstructionPersonCode, dd.ConstrSubPersonCode, dd.ConstructionInstructor);
+                dd.Visible = true;
                 dd.ConfirmationDate = "";
                 if (CommonMotions.cnvString(invoice[(int)GetDataFirst.ConfirmationDate]) != "0001-01-01")
                     dd.ConfirmationDate = CommonMotions.cnvString(invoice[(int)GetDataFirst.ConfirmationDate]);
@@ -1091,6 +1241,13 @@
                 o.DepositDetails.Add(dd);
 
                 data.Add(o);
+
+                // 最終行かつ最後の請求データに請求書データがない場合に合計行のみ追加する
+                if (lastSumDataCheck && invoiceDataCount == dataCount)
+                {
+                    // 合計行用のデータを追加
+                    data.Add(oSumV);
+                }
             }
             return data;
         }
@@ -1129,6 +1286,7 @@
                 sql.Append("   , NULL AS NOTE ");
                 sql.Append("   , NULL AS ORDERNO ");
                 sql.Append("   , NULL AS DEPOSITAMOUNT ");
+                sql.Append("   , NULL AS TAXAMOUNT ");
                 sql.Append("   , NULL AS DISCOUNTAMOUNT ");
                 sql.Append("   , NULL AS CNSTRPRICE ");
                 sql.Append("   , NULL AS FEES ");
@@ -1173,6 +1331,7 @@
                 sql.Append("   , NULL AS NOTE ");
                 sql.Append("   , H.ORDERNO ");
                 sql.Append("   , DPDE.DEPOSITAMOUNT ");
+                sql.Append("   , DPDE.TAXAMOUNT ");
                 sql.Append("   , DPDE.DISCOUNTAMOUNT ");
                 sql.Append("   , DPDE.CNSTRPRICE ");
                 sql.Append("   , DPDE.FEES ");
@@ -1329,6 +1488,52 @@
         }
         #endregion
 
+        #region 入金明細の合計を取得
+        /// <summary>
+        /// 入金合計を取得
+        /// </summary>
+        /// <returns></returns>
+        private ArrayList DepositDetailSumCalc(int orderersDiv, int orderersCd, int targetDate)
+        {
+            var ivD = new IODepositData();
+
+            try
+            {
+                var sql = new StringBuilder();
+                sql.Append(" SELECT ");
+                sql.Append("   SUM(DEPOSITAMOUNT) ");
+                sql.Append("   , SUM(TAXAMOUNT) ");
+                sql.Append("   , SUM(DISCOUNTAMOUNT) ");
+                sql.Append("   , SUM(CNSTRPRICE) ");
+                sql.Append("   , SUM(FEES) ");
+                sql.Append("   , SUM(OTHERADJUSTMENTS) ");
+                sql.Append("   , SUM(DIFFERENCEAMOUNT) ");
+                sql.Append(" FROM ");
+                sql.Append("   DEPOSITDATADETAIL ");
+                sql.Append(" WHERE ");
+                sql.AppendFormat(" ORDERERSDIVISION = {0} ", orderersDiv);
+                sql.AppendFormat(" AND ORDERERSCODE = {0} ", orderersCd);
+                sql.AppendFormat(" AND TARGETDATE = {0} ", targetDate);
+                var data = new ArrayList();
+                if (!ivD.ExecuteReader(sql.ToString(), ref data))
+                {
+                    return new ArrayList();
+                }
+                return data;
+            }
+            catch (Exception ex)
+            {
+                logger.ErrorFormat("システムエラー：{0}：{1}", CommonMotions.GetMethodName(), ex.Message);
+                return new ArrayList();
+            }
+            finally
+            {
+                ivD.close();
+                ivD = null;
+            }
+        }
+        #endregion
+
         #region 変更行の内容を更新する。
         /// <summary>
         /// 変更行の内容を更新する。
@@ -1380,51 +1585,24 @@
 
                 if (depositOrderer.KB == 1)
                 {
+                    // 表示権限確認
+                    var visibleCheck = CheckPermission(depositOrderer);
+                    dgvMaster.Rows[position].Visible = visibleCheck;
+
                     // 請求先情報の表示
+                    ordererRow.Cells[(int)DispColumn.KB].Style.BackColor = Color.Gainsboro;
                     ordererRow.Cells[(int)DispColumn.No].Style.BackColor = Color.Gainsboro;
                     ordererRow.Cells[(int)DispColumn.RequestMonth].Style.BackColor = Color.Gainsboro;
                     ordererRow.Cells[(int)DispColumn.OrderersName].Style.BackColor = Color.Gainsboro;
 
+                    ordererRow.Cells[(int)DispColumn.KB].Value = depositOrderer.KB;
                     ordererRow.Cells[(int)DispColumn.RequestMonth].Value = depositOrderer.RequestMonth;
                     ordererRow.Cells[(int)DispColumn.OrderersDivision].Value = depositOrderer.OrderersDivision;
                     ordererRow.Cells[(int)DispColumn.OrderersCode].Value = depositOrderer.OrderersCode;
                     ordererRow.Cells[(int)DispColumn.OrderersName].Value = depositOrderer.OrderersName;
+                    ordererRow.Cells[(int)DispColumn.DepositAmountCash].Style.BackColor = Color.Gainsboro;
+                    ordererRow.Cells[(int)DispColumn.DepositAmountBill].Style.BackColor = Color.Gainsboro;
 
-                    // 入金金額の合計を算出
-                    int tgl = 1;
-                    var DepositSum = DepositSumCalc(depositOrderer.OrderersDivision, depositOrderer.OrderersCode, depositOrderer.RequestMonth, tgl).OfType<object[]>();
-                    int SumDepositAmountCash = 0;
-                    int SumDepositAmountBill = 0;
-                    foreach (var sum in DepositSum)
-                    {
-                        SumDepositAmountCash = CommonMotions.cnvInt(sum[0]);
-                        SumDepositAmountBill = CommonMotions.cnvInt(sum[1]);
-                    }
-
-                    // 請求金額合計の合計を算出
-                    var RequestSum = RequestSumCalc(depositOrderer.OrderersDivision, depositOrderer.OrderersCode, depositOrderer.RequestMonth, tgl).OfType<object[]>();
-                    int SumRequestBill = 0;
-                    int SumRequestTax = 0;
-                    foreach (var sum in RequestSum)
-                    {
-                        SumRequestBill = CommonMotions.cnvInt(sum[0]);
-                        SumRequestTax = CommonMotions.cnvInt(sum[1]);
-                    }
-
-
-
-                    index = 0;
-                    foreach (var deposit in depositOrderer.VisibleDeposits)
-                    {
-                        var row = dgvMaster.Rows[position + index];
-                        ordererRow.Cells[(int)DispColumn.DepositAmountCash].Style.BackColor = Color.Gainsboro;
-                        ordererRow.Cells[(int)DispColumn.DepositAmountBill].Style.BackColor = Color.Gainsboro;
-
-                        SetPrice(row.Cells, (int)DispColumn.DepositAmountCash, (long)SumDepositAmountCash);
-                        SetPrice(row.Cells, (int)DispColumn.DepositAmountBill, (long)SumDepositAmountBill);
-                        index++;
-                    }
-
                     // 入金明細情報の表示       
                     index = 0;
                     foreach (var depositDetail in depositOrderer.VisibleDepositDetails)
@@ -1438,10 +1616,8 @@
                         row.Cells[(int)DispColumn.TaxPrice].Style.BackColor = Color.Gainsboro;
                         row.Cells[(int)DispColumn.BillPrice].Style.BackColor = Color.Gainsboro;
 
-                        SetPrice(row.Cells, (int)DispColumn.BillPrice, SumRequestBill);
-                        SetPrice(row.Cells, (int)DispColumn.TaxPrice, SumRequestTax);
-
                         row.Cells[(int)DispColumn.DepositAmount].Style.BackColor = Color.Gainsboro;
+                        row.Cells[(int)DispColumn.TaxAmount].Style.BackColor = Color.Gainsboro;
                         row.Cells[(int)DispColumn.DiscountAmount].Style.BackColor = Color.Gainsboro;
                         row.Cells[(int)DispColumn.CnstrPrice].Style.BackColor = Color.Gainsboro;
                         row.Cells[(int)DispColumn.Fees].Style.BackColor = Color.Gainsboro;
@@ -1449,6 +1625,7 @@
                         row.Cells[(int)DispColumn.DifferentAmount].Style.BackColor = Color.Gainsboro;
 
                         row.Cells[(int)DispColumn.DepositAmount].ReadOnly = true;
+                        row.Cells[(int)DispColumn.TaxAmount].ReadOnly = true;
                         row.Cells[(int)DispColumn.DiscountAmount].ReadOnly = true;
                         row.Cells[(int)DispColumn.CnstrPrice].ReadOnly = true;
                         row.Cells[(int)DispColumn.Fees].ReadOnly = true;
@@ -1465,23 +1642,192 @@
                         row.Cells[(int)DispColumn.PersonName].Style.BackColor = Color.Gainsboro;
                         row.Cells[(int)DispColumn.NoteDD].Style.BackColor = Color.Gainsboro;
 
+                        index++;
+                    }
+                }
+                // 合計行の表示
+                else if (depositOrderer.KB == 3)
+                {
+                    // 表示権限確認
+                    var visibleCheck = CheckPermission(depositOrderer);
+                    dgvMaster.Rows[position].Visible = visibleCheck;
 
-                        // 担当者承認
-                        if (depositDetail.ConfirmationEndFlg == 1)
+                    ordererRow.Cells[(int)DispColumn.KB].Value = depositOrderer.KB;
+                    ordererRow.Cells[(int)DispColumn.OrderersName].Value = "合計";
+                    ordererRow.Cells[(int)DispColumn.RequestMonth].Value = depositOrderer.RequestMonth;
+                    ordererRow.Cells[(int)DispColumn.OrderersDivision].Value = depositOrderer.OrderersDivision;
+                    ordererRow.Cells[(int)DispColumn.OrderersCode].Value = depositOrderer.OrderersCode;
+
+                    // 入金金額の合計を算出
+                    int tgl = 1;
+                    var DepositSum = DepositSumCalc(depositOrderer.OrderersDivision, depositOrderer.OrderersCode, depositOrderer.RequestMonth, tgl).OfType<object[]>();
+                    int SumDepositAmountCash = 0;
+                    int SumDepositAmountBill = 0;
+                    foreach (var sum in DepositSum)
+                    {
+                        SumDepositAmountCash = CommonMotions.cnvInt(sum[0]);
+                        SumDepositAmountBill = CommonMotions.cnvInt(sum[1]);
+                    }
+
+                    //請求金額合計の合計を算出
+                    var RequestSum = RequestSumCalc(depositOrderer.OrderersDivision, depositOrderer.OrderersCode, depositOrderer.RequestMonth, tgl).OfType<object[]>();
+                    int SumRequestBill = 0;
+                    int SumRequestTax = 0;
+                    foreach (var sum in RequestSum)
+                    {
+                        SumRequestBill = CommonMotions.cnvInt(sum[0]);
+                        SumRequestTax = CommonMotions.cnvInt(sum[1]);
+                    }
+                    
+                    SetPrice(ordererRow.Cells, (int)DispColumn.DepositAmountCash, (long)SumDepositAmountCash);
+                    SetPrice(ordererRow.Cells, (int)DispColumn.DepositAmountBill, (long)SumDepositAmountBill);
+
+                    // 入金明細金額の合計を算出
+                    var DepositDetailSum = DepositDetailSumCalc(depositOrderer.OrderersDivision, depositOrderer.OrderersCode, depositOrderer.RequestMonth).OfType<object[]>();
+                    int DepositAmountSum = 0;
+                    int TaxAmountSum = 0;
+                    int DiscountAmountSum = 0;
+                    int CnstrPriceSum = 0;
+                    int FeesSum = 0;
+                    int OtherAdjustmentsSum = 0;
+                    int DifferenceAmountSum = 0;
+
+                    for (int dgvRowCnt = 0; dgvRowCnt < dgvMaster.RowCount; dgvRowCnt++)
+                    {
+                        // 明細行が明細区分で発注者コードと発注者区分が同一のカラムの計算を行う。
+                        if (CommonMotions.cnvInt(dgvMaster.Rows[dgvRowCnt].Cells[(int)DispColumn.KB].Value) == 2
+                            && CommonMotions.cnvInt(dgvMaster.Rows[dgvRowCnt].Cells[(int)DispColumn.OrderersDivision].Value) == CommonMotions.cnvInt(ordererRow.Cells[(int)DispColumn.OrderersDivision].Value)
+                            && CommonMotions.cnvInt(dgvMaster.Rows[dgvRowCnt].Cells[(int)DispColumn.OrderersCode].Value) == CommonMotions.cnvInt(ordererRow.Cells[(int)DispColumn.OrderersCode].Value))
                         {
-                            row.Cells[(int)DispColumn.PersonName].Style.ForeColor = Color.Red;
+                            DepositAmountSum += CommonMotions.cnvInt(dgvMaster.Rows[dgvRowCnt].Cells[(int)DispColumn.DepositAmount].Value);
+                            TaxAmountSum += CommonMotions.cnvInt(dgvMaster.Rows[dgvRowCnt].Cells[(int)DispColumn.TaxAmount].Value);
+                            DiscountAmountSum += CommonMotions.cnvInt(dgvMaster.Rows[dgvRowCnt].Cells[(int)DispColumn.DiscountAmount].Value);
+                            CnstrPriceSum += CommonMotions.cnvInt(dgvMaster.Rows[dgvRowCnt].Cells[(int)DispColumn.CnstrPrice].Value);
+                            FeesSum += CommonMotions.cnvInt(dgvMaster.Rows[dgvRowCnt].Cells[(int)DispColumn.Fees].Value);
+                            OtherAdjustmentsSum += CommonMotions.cnvInt(dgvMaster.Rows[dgvRowCnt].Cells[(int)DispColumn.OtherAdjustments].Value);
+                            DifferenceAmountSum += CommonMotions.cnvInt(dgvMaster.Rows[dgvRowCnt].Cells[(int)DispColumn.DifferentAmount].Value);
                         }
-                        // 担当者未承認
-                        else
-                        {
-                            row.Cells[(int)DispColumn.PersonName].Style.ForeColor = Color.Gray;
-                        }
+                    }
 
-                        index++;
+                    ordererRow.Cells[(int)DispColumn.No].Style.BackColor = Color.LightGoldenrodYellow;
+                    ordererRow.Cells[(int)DispColumn.RequestMonth].Style.BackColor = Color.LightGoldenrodYellow;
+                    ordererRow.Cells[(int)DispColumn.OrderersName].Style.BackColor = Color.LightGoldenrodYellow;
+                    ordererRow.Cells[(int)DispColumn.DepositAmountCash].Style.BackColor = Color.LightGoldenrodYellow;
+                    ordererRow.Cells[(int)DispColumn.DepositAmountBill].Style.BackColor = Color.LightGoldenrodYellow;
+
+                    ordererRow.Cells[(int)DispColumn.ConstructionCode].Style.BackColor = Color.LightGoldenrodYellow;
+                    ordererRow.Cells[(int)DispColumn.RequestNo].Style.BackColor = Color.LightGoldenrodYellow;
+                    ordererRow.Cells[(int)DispColumn.ConstructionName].Style.BackColor = Color.LightGoldenrodYellow;
+                    ordererRow.Cells[(int)DispColumn.OrderNo].Style.BackColor = Color.LightGoldenrodYellow;
+
+                    ordererRow.Cells[(int)DispColumn.TaxPrice].Style.BackColor = Color.LightGoldenrodYellow;
+                    ordererRow.Cells[(int)DispColumn.BillPrice].Style.BackColor = Color.LightGoldenrodYellow;
+                    SetPrice(ordererRow.Cells, (int)DispColumn.BillPrice, SumRequestBill);
+                    SetPrice(ordererRow.Cells, (int)DispColumn.TaxPrice, SumRequestTax);
+
+                    ordererRow.Cells[(int)DispColumn.DepositAmount].Style.BackColor = Color.LightGoldenrodYellow;
+                    ordererRow.Cells[(int)DispColumn.TaxAmount].Style.BackColor = Color.LightGoldenrodYellow;
+                    ordererRow.Cells[(int)DispColumn.DiscountAmount].Style.BackColor = Color.LightGoldenrodYellow;
+                    ordererRow.Cells[(int)DispColumn.CnstrPrice].Style.BackColor = Color.LightGoldenrodYellow;
+                    ordererRow.Cells[(int)DispColumn.Fees].Style.BackColor = Color.LightGoldenrodYellow;
+                    ordererRow.Cells[(int)DispColumn.OtherAdjustments].Style.BackColor = Color.LightGoldenrodYellow;
+                    if (DifferenceAmountSum < 0)
+                    {
+                        ordererRow.Cells[(int)DispColumn.DifferentAmount].Style.BackColor = Color.Yellow;
                     }
+                    else
+                    {
+                        ordererRow.Cells[(int)DispColumn.DifferentAmount].Style.BackColor = Color.LightGoldenrodYellow;
+                    }
+
+                    SetPrice(ordererRow.Cells, (int)DispColumn.DepositAmount, DepositAmountSum);
+                    SetPrice(ordererRow.Cells, (int)DispColumn.TaxAmount, TaxAmountSum);
+                    SetPrice(ordererRow.Cells, (int)DispColumn.DiscountAmount, DiscountAmountSum);
+                    SetPrice(ordererRow.Cells, (int)DispColumn.CnstrPrice, CnstrPriceSum);
+                    SetPrice(ordererRow.Cells, (int)DispColumn.Fees, FeesSum);
+                    SetPrice(ordererRow.Cells, (int)DispColumn.OtherAdjustments, OtherAdjustmentsSum);
+                    SetPrice(ordererRow.Cells, (int)DispColumn.DifferentAmount, DifferenceAmountSum);
+
+                    ordererRow.Cells[(int)DispColumn.DepositAmount].ReadOnly = true;
+                    ordererRow.Cells[(int)DispColumn.TaxAmount].ReadOnly = true;
+                    ordererRow.Cells[(int)DispColumn.DiscountAmount].ReadOnly = true;
+                    ordererRow.Cells[(int)DispColumn.CnstrPrice].ReadOnly = true;
+                    ordererRow.Cells[(int)DispColumn.Fees].ReadOnly = true;
+                    ordererRow.Cells[(int)DispColumn.OtherAdjustments].ReadOnly = true;
+                    ordererRow.Cells[(int)DispColumn.NoteDD].ReadOnly = true;
+
+                    ordererRow.Cells[(int)DispColumn.ConfirmationPersonCode].Style.BackColor = Color.LightGoldenrodYellow;
+                    ordererRow.Cells[(int)DispColumn.ConfirmationDate].Style.BackColor = Color.LightGoldenrodYellow;
+                    ordererRow.Cells[(int)DispColumn.ConfirmationEndFlg].Style.BackColor = Color.LightGoldenrodYellow;
+                    ordererRow.Cells[(int)DispColumn.ConstructionPersonCode].Style.BackColor = Color.LightGoldenrodYellow;
+                    ordererRow.Cells[(int)DispColumn.ConstrSubPersonCode].Style.BackColor = Color.LightGoldenrodYellow;
+                    ordererRow.Cells[(int)DispColumn.ConstructionInstructor].Style.BackColor = Color.LightGoldenrodYellow;
+                    ordererRow.Cells[(int)DispColumn.DepartmentCode].Style.BackColor = Color.LightGoldenrodYellow;
+                    ordererRow.Cells[(int)DispColumn.PersonName].Style.BackColor = Color.LightGoldenrodYellow;
+                    ordererRow.Cells[(int)DispColumn.NoteDD].Style.BackColor = Color.LightGoldenrodYellow;
                 }
+                // 空行を追加
+                else if (depositOrderer.KB == 4)
+                {
+                    // 表示権限確認
+                    var visibleCheck = CheckPermission(depositOrderer);
+                    dgvMaster.Rows[position].Visible = visibleCheck;
+
+                    ordererRow.Cells[(int)DispColumn.KB].Value = depositOrderer.KB;
+                    ordererRow.Cells[(int)DispColumn.RequestMonth].Value = depositOrderer.RequestMonth;
+                    ordererRow.Cells[(int)DispColumn.OrderersDivision].Value = depositOrderer.OrderersDivision;
+                    ordererRow.Cells[(int)DispColumn.OrderersCode].Value = depositOrderer.OrderersCode;
+
+                    ordererRow.Cells[(int)DispColumn.No].Style.BackColor = Color.White;
+                    ordererRow.Cells[(int)DispColumn.RequestMonth].Style.BackColor = Color.White;
+                    ordererRow.Cells[(int)DispColumn.OrderersName].Style.BackColor = Color.White;
+                    ordererRow.Cells[(int)DispColumn.DepositAmountCash].Style.BackColor = Color.White;
+                    ordererRow.Cells[(int)DispColumn.DepositAmountBill].Style.BackColor = Color.White;
+                    ordererRow.Cells[(int)DispColumn.ConstructionCode].Style.BackColor = Color.White;
+                    ordererRow.Cells[(int)DispColumn.RequestNo].Style.BackColor = Color.White;
+                    ordererRow.Cells[(int)DispColumn.ConstructionName].Style.BackColor = Color.White;
+                    ordererRow.Cells[(int)DispColumn.OrderNo].Style.BackColor = Color.White;
+                    ordererRow.Cells[(int)DispColumn.TaxPrice].Style.BackColor = Color.White;
+                    ordererRow.Cells[(int)DispColumn.BillPrice].Style.BackColor = Color.White;
+                    ordererRow.Cells[(int)DispColumn.DepositAmount].Style.BackColor = Color.White;
+                    ordererRow.Cells[(int)DispColumn.TaxAmount].Style.BackColor = Color.White;
+                    ordererRow.Cells[(int)DispColumn.DiscountAmount].Style.BackColor = Color.White;
+                    ordererRow.Cells[(int)DispColumn.CnstrPrice].Style.BackColor = Color.White;
+                    ordererRow.Cells[(int)DispColumn.Fees].Style.BackColor = Color.White;
+                    ordererRow.Cells[(int)DispColumn.OtherAdjustments].Style.BackColor = Color.White;
+                    ordererRow.Cells[(int)DispColumn.DifferentAmount].Style.BackColor = Color.White;
+
+                    ordererRow.Cells[(int)DispColumn.DepositAmount].ReadOnly = true;
+                    ordererRow.Cells[(int)DispColumn.TaxAmount].ReadOnly = true;
+                    ordererRow.Cells[(int)DispColumn.DiscountAmount].ReadOnly = true;
+                    ordererRow.Cells[(int)DispColumn.CnstrPrice].ReadOnly = true;
+                    ordererRow.Cells[(int)DispColumn.Fees].ReadOnly = true;
+                    ordererRow.Cells[(int)DispColumn.OtherAdjustments].ReadOnly = true;
+                    ordererRow.Cells[(int)DispColumn.NoteDD].ReadOnly = true;
+
+                    ordererRow.Cells[(int)DispColumn.ConfirmationPersonCode].Style.BackColor = Color.White;
+                    ordererRow.Cells[(int)DispColumn.ConfirmationDate].Style.BackColor = Color.White;
+                    ordererRow.Cells[(int)DispColumn.ConfirmationEndFlg].Style.BackColor = Color.White;
+                    ordererRow.Cells[(int)DispColumn.ConstructionPersonCode].Style.BackColor = Color.White;
+                    ordererRow.Cells[(int)DispColumn.ConstrSubPersonCode].Style.BackColor = Color.White;
+                    ordererRow.Cells[(int)DispColumn.ConstructionInstructor].Style.BackColor = Color.White;
+                    ordererRow.Cells[(int)DispColumn.DepartmentCode].Style.BackColor = Color.White;
+                    ordererRow.Cells[(int)DispColumn.PersonName].Style.BackColor = Color.White;
+                    ordererRow.Cells[(int)DispColumn.NoteDD].Style.BackColor = Color.White;
+                }
+                // 明細行の表示
                 else
                 {
+
+                    // 表示権限のチェックを行う
+                    if (CommonMotions.LoginUserData.DepartmentCode != CommonDefine.s_GeneralAffairsDevision && 
+                        m_UserInfo.m_Type != CommonDefine.SecurityRankPos.SpecialAuthority)
+                    {
+                        var visibleCheck = CheckDepositDetailPermission(depositOrderer);
+                        dgvMaster.Rows[position].Visible = visibleCheck;
+                    }
+
+                    ordererRow.Cells[(int)DispColumn.KB].Value = depositOrderer.KB;
                     // 請求先情報の表示
                     ordererRow.Cells[(int)DispColumn.No].Value = depositOrderer.No;
                     ordererRow.Cells[(int)DispColumn.RequestMonth].Value = depositOrderer.RequestMonth;
@@ -1510,6 +1856,7 @@
                         SetPrice(row.Cells, (int)DispColumn.BillPrice, depositDetail.BillPrice);
                         SetPrice(row.Cells, (int)DispColumn.TaxPrice, depositDetail.TaxPrice);
                         SetPrice(row.Cells, (int)DispColumn.DepositAmount, depositDetail.DepositAmount);
+                        SetPrice(row.Cells, (int)DispColumn.TaxAmount, depositDetail.TaxAmount);
                         SetPrice(row.Cells, (int)DispColumn.DiscountAmount, depositDetail.DiscountAmount);
                         SetPrice(row.Cells, (int)DispColumn.CnstrPrice, depositDetail.CnstrPrice);
                         SetPrice(row.Cells, (int)DispColumn.Fees, depositDetail.Fees);
@@ -1516,6 +1863,7 @@
                         SetPrice(row.Cells, (int)DispColumn.OtherAdjustments, depositDetail.OtherAdjustments);
 
                         row.Cells[(int)DispColumn.DepositAmount].Style.BackColor = Color.LightCyan;
+                        row.Cells[(int)DispColumn.TaxAmount].Style.BackColor = Color.LightCyan;
                         row.Cells[(int)DispColumn.DiscountAmount].Style.BackColor = Color.LightCyan;
                         row.Cells[(int)DispColumn.CnstrPrice].Style.BackColor = Color.LightCyan;
                         row.Cells[(int)DispColumn.Fees].Style.BackColor = Color.LightCyan;
@@ -1523,7 +1871,7 @@
                         row.Cells[(int)DispColumn.DifferentAmount].Style.BackColor = Color.LightCyan;
 
                         long RequestAmount = depositDetail.BillPrice + depositDetail.TaxPrice;
-                        long DepositAmount = depositDetail.DepositAmount + depositDetail.DiscountAmount
+                        long DepositAmount = depositDetail.DepositAmount + depositDetail.TaxAmount + depositDetail.DiscountAmount
                             + depositDetail.CnstrPrice + depositDetail.Fees + depositDetail.OtherAdjustments;
                         depositDetail.DifferenceAmount = DepositAmount - RequestAmount;
 
@@ -1545,6 +1893,7 @@
                         if (CanEditDepositDetail(depositDetail))
                         {
                             row.Cells[(int)DispColumn.DepositAmount].ReadOnly = false;
+                            row.Cells[(int)DispColumn.TaxAmount].ReadOnly = false;
                             row.Cells[(int)DispColumn.DiscountAmount].ReadOnly = false;
                             row.Cells[(int)DispColumn.CnstrPrice].ReadOnly = false;
                             row.Cells[(int)DispColumn.Fees].ReadOnly = false;
@@ -1554,6 +1903,7 @@
                         else
                         {
                             row.Cells[(int)DispColumn.DepositAmount].ReadOnly = true;
+                            row.Cells[(int)DispColumn.TaxAmount].ReadOnly = true;
                             row.Cells[(int)DispColumn.DiscountAmount].ReadOnly = true;
                             row.Cells[(int)DispColumn.CnstrPrice].ReadOnly = true;
                             row.Cells[(int)DispColumn.Fees].ReadOnly = true;
@@ -1685,6 +2035,25 @@
         }
         #endregion
 
+        #region 指定行から合計行を検索
+        /// <summary>
+        /// 指定行から合計行を検索
+        /// </summary>
+        /// <param name="index"></param>
+        /// <returns></returns>
+        private int DetectSumIndex(int index)
+        {
+            for (var i = index; i >= 0; i++)
+            {
+                if (CommonMotions.cnvInt(dgvMaster.Rows[i].Cells[(int)DispColumn.KB].Value) == 3)
+                {
+                    return i;
+                }
+            }
+            return 0;
+        }
+        #endregion
+
         #region 入金請求先情報からヘッダ行を検索
         /// <summary>
         /// 入金請求先情報からヘッダ行を検索
@@ -1754,6 +2123,7 @@
         {
             // ヘッダ色、-1:非表示、0:自動計算、1:総務、2：工事
             int[] mc = {
+                0,                      // KB
                 0,                      // No  
                 -1,                     // ■請求月
                 -1,                     // ■請求No.
@@ -1769,7 +2139,8 @@
                 1,                      // 入金金額 (手形)
 
                 2,                      // ■受付番号
-                2,                      // 入金金額
+                2,                      // 入金金額（税抜）
+                2,                      // 入金金額（消費税）
                 2,                      // 値引金額
                 2,                      // 協力金
                 2,                      // 手数料
@@ -1813,187 +2184,231 @@
         }
         #endregion
 
-        #region 表示権限のチェックを実施する。
+        #region 請求行の表示権限のチェックを実施する。
         /// <summary>
-        /// 表示権限のチェックを実施する。
+        /// 請求行の表示権限のチェックを実施する。
         /// </summary>
         /// <param name="orderer"></param>
         /// <returns></returns>
-        private bool CheckOrdererPermission(DepositOrderer orderer)
+        private bool CheckDepositDetailPermission(DepositOrderer depositOrderer)
         {
+            var ioCbi = new IOConstructionBaseInfo();
+            var SalesDepCodeData = 0;
+            var SalesPersonCodeData = 0;
+            var SalesSubDepCodeData = 0;
+            var SalesSubPersonCodeData = 0;
 
-            // すべて表示させる
-            return true;
+            var ConstrDepCodeData = 0;
+            var ConstructionPersonCodeData = 0;
+            var ConstrSubDepCodeData = 0;
+            var ConstrSubPersonCodeData = 0;
+            var ConstrInstrDepCodeData = 0;
+            var ConstructionInstructorData = 0;
 
-            #region 表示権限
-            //var ioDepData = new IODepositData();
-            //var ioDepDtl = new IODepositDataDetail();
+            try
+            {
+                var doDepDetails = depositOrderer.VisibleDepositDetails;
+                var data = new ArrayList();
+                var sql = new StringBuilder();
+                sql.Append(" SELECT ");
+                sql.Append(" SALESDEPCODE ");
+                sql.Append(" , SALESPERSONCODE ");
+                sql.Append(" , SALESSUBDEPCODE ");
+                sql.Append(" , SALESSUBPERSONCODE ");
+                sql.Append(" , CONSTRDEPCODE ");
+                sql.Append(" , CONSTRUCTIONPERSONCODE ");
+                sql.Append(" , CONSTRSUBDEPCODE ");
+                sql.Append(" , CONSTRSUBPERSONCODE ");
+                sql.Append(" , CONSTRINSTRDEPCODE ");
+                sql.Append(" , CONSTRUCTIONINSTRUCTOR ");
+                sql.Append(" FROM CONSTRUCTIONBASEINFO ");
+                sql.AppendFormat(" WHERE CONSTRUCTIONCODE  = {0}; ", doDepDetails[0].ConstructionCode);
+                if (!ioCbi.ExecuteReader(sql.ToString(), ref data))
+                {
+                    return false;
+                }
+                foreach (object[] work in data)
+                {
+                    SalesDepCodeData = CommonMotions.cnvInt(work[0]);
+                    SalesPersonCodeData = CommonMotions.cnvInt(work[1]);
+                    SalesSubDepCodeData = CommonMotions.cnvInt(work[2]);
+                    SalesSubPersonCodeData = CommonMotions.cnvInt(work[3]);
+                    ConstrDepCodeData = CommonMotions.cnvInt(work[4]);
+                    ConstructionPersonCodeData = CommonMotions.cnvInt(work[5]);
+                    ConstrSubDepCodeData = CommonMotions.cnvInt(work[6]);
+                    ConstrSubPersonCodeData = CommonMotions.cnvInt(work[7]);
+                    ConstrInstrDepCodeData = CommonMotions.cnvInt(work[8]);
+                    ConstructionInstructorData = CommonMotions.cnvInt(work[9]);
+                }
 
-            //try
-            //{
-            //    // 全部署対象
-            //    if (m_UserInfo.m_SecRange == ClsSecurityPermission.SecRangeType.AllDepartment)
-            //    {
-            //        return true;
-            //    }
-
-            //    var sql = new StringBuilder();
-            //    var arWork = new ArrayList();
-            //    sql.Length = 0;
-            //    var arDataPdm = new ArrayList();
-
-            //    // 担当分のみ対象の場合
-            //    if (m_UserInfo.m_SecRange == ClsSecurityPermission.SecRangeType.InCharge)
-            //    {
-            //        sql.Append("SELECT COUNT(*) FROM DepositDataDetail DepDtl ");
-            //        sql.Append("INNER JOIN RequestHead ReqHead ON ");
-            //        sql.Append("DepDtl.RequestNo = ReqHead.RequestNo ");
-            //        sql.Append("INNER JOIN ConstructionBaseInfo Info ON ");
-            //        sql.Append("ReqHead.ReqConstructionCode = Info.ConstructionCode ");
-            //        sql.AppendFormat("WHERE DepDtl.OrderersDivision = {0} ", orderer.OrderersDivision);
-            //        sql.AppendFormat("AND DepDtl.OrderersCode = {0} ", orderer.OrderersCode);
-            //        sql.AppendFormat("AND DepDtl.TargetDate = {0} ", m_Select_TargetDate);
-            //        sql.AppendFormat("AND (Info.ConstructionPersonCode = {0} OR Info.ConstrSubPersonCode = {0} OR Info.ConstructionInstructor = {0}) ", CommonMotions.LoginUserData.PersonCode);
-            //    }
-            //    // 自部署のみ
-            //    else if (m_UserInfo.m_SecRange == ClsSecurityPermission.SecRangeType.OneDepartment)
-            //    {
-            //        sql.Append("SELECT COUNT(*) FROM DepositDataDetail DepDtl ");
-            //        sql.Append("INNER JOIN RequestHead ReqHead ON ");
-            //        sql.Append("DepDtl.RequestNo = ReqHead.RequestNo ");
-            //        sql.Append("INNER JOIN ConstructionBaseInfo Info ON ");
-            //        sql.Append("ReqHead.ReqConstructionCode = Info.ConstructionCode ");
-            //        sql.Append("INNER JOIN PersonInChargeMaster Prsn ON ");
-            //        sql.Append("Info.ConstructionPersonCode = Prsn.PersonCode ");
-            //        sql.AppendFormat("WHERE DepDtl.OrderersDivision = {0} ", orderer.OrderersDivision);
-            //        sql.AppendFormat("AND DepDtl.OrderersCode = {0} ", orderer.OrderersCode);
-            //        sql.AppendFormat("AND DepDtl.TargetDate = {0} ", m_Select_TargetDate);
-            //        sql.AppendFormat("AND Prsn.DepartmentCode = {0} ", CommonMotions.LoginUserData.DepartmentCode);
-            //    }
-            //    // 複数部署
-            //    else if (m_UserInfo.m_SecRange == ClsSecurityPermission.SecRangeType.MultiDepartment)
-            //    {
-            //        sql.Append("SELECT COUNT(*) FROM DepositDataDetail DepDtl ");
-            //        sql.Append("INNER JOIN RequestHead ReqHead ON ");
-            //        sql.Append("DepDtl.RequestNo = ReqHead.RequestNo ");
-            //        sql.Append("INNER JOIN ConstructionBaseInfo Info ON ");
-            //        sql.Append("ReqHead.ReqConstructionCode = Info.ConstructionCode ");
-            //        sql.Append("INNER JOIN PersonInChargeMaster Prsn ON ");
-            //        sql.Append("Info.ConstructionPersonCode = Prsn.PersonCode ");
-            //        sql.Append("INNER JOIN PersonDepartmentMaster PrsnDep ON ");
-            //        sql.Append("Prsn.DepartmentCode = PrsnDep.DepartmentCode ");
-            //        sql.AppendFormat("WHERE DepDtl.OrderersDivision = {0} ", orderer.OrderersDivision);
-            //        sql.AppendFormat("AND DepDtl.OrderersCode = {0} ", orderer.OrderersCode);
-            //        sql.AppendFormat("AND DepDtl.TargetDate = {0} ", m_Select_TargetDate);
-            //        sql.AppendFormat("AND PrsnDep.PersonCode = {0} ", CommonMotions.LoginUserData.PersonCode);
-
-            //    }
-
-            //    if (!ioDepDtl.ExecuteReader(sql.ToString(), ref arDataPdm))
-            //        return false;
-
-            //    int nCount = CommonMotions.cnvInt(((object[])arDataPdm[0])[0]);
-
-            //    // 権限を所有する工事がある場合は保持
-            //    if (nCount > 0)
-            //    {
-            //        return true;
-            //    }
-            //    else
-            //    {
-            //        return false;
-            //    }
-            //}
-            //catch (Exception ex)
-            //{
-            //    logger.ErrorFormat("システムエラー：{0}：{1}", CommonMotions.GetMethodName(), ex.Message);
-            //    return false;
-            //}
-            //finally
-            //{
-            //    ioDepData.close();
-            //    ioDepData = null;
-            //    ioDepDtl.close();
-            //    ioDepDtl = null;
-            //}
-            #endregion
+                // 特別権限と総務は表示
+                if (CommonMotions.LoginUserData.DepartmentCode == CommonDefine.s_GeneralAffairsDevision ||
+                        m_UserInfo.m_Type == CommonDefine.SecurityRankPos.SpecialAuthority)
+                {
+                    return true;
+                }
+                // 複数部署対象、または自部署のみ対象
+                else if ((m_UserInfo.m_SecRange == ClsSecurityPermission.SecRangeType.MultiDepartment) || 
+                    (m_UserInfo.m_SecRange == ClsSecurityPermission.SecRangeType.OneDepartment))
+                {
+                    if (CommonMotions.LoginUserData.DepartmentCode == SalesDepCodeData ||
+                        CommonMotions.LoginUserData.DepartmentCode == SalesSubDepCodeData ||
+                        CommonMotions.LoginUserData.DepartmentCode == ConstrDepCodeData ||
+                        CommonMotions.LoginUserData.DepartmentCode == ConstrSubDepCodeData ||
+                        CommonMotions.LoginUserData.DepartmentCode == ConstrInstrDepCodeData)
+                    {
+                        return true;
+                    }
+                }
+                // 自分の担当の場合は表示
+                else if(CommonMotions.LoginUserData.PersonCode == SalesPersonCodeData ||
+                    CommonMotions.LoginUserData.PersonCode == SalesSubPersonCodeData ||
+                    CommonMotions.LoginUserData.PersonCode == ConstructionPersonCodeData ||
+                CommonMotions.LoginUserData.PersonCode == ConstrSubPersonCodeData ||
+                CommonMotions.LoginUserData.PersonCode == ConstructionInstructorData)
+                {
+                    return true;
+                }
+                return false;
+            }
+            catch(Exception ex)
+            {
+                logger.ErrorFormat("システムエラー：{0}：{1}", CommonMotions.GetMethodName(), ex.Message);
+                return false;
+            }
+            finally
+            {
+                ioCbi.close();
+                ioCbi = null;
+            }
         }
         #endregion
 
-        #region 表示権限のチェックを実施する。
+        #region 請求先行・合計行の表示権限のチェックを実施する。
         /// <summary>
         /// 表示権限のチェックを実施する。
         /// </summary>
-        /// <param name="DepartmentCode"></param>
-        /// <param name="ConstructionPersonCode"></param>
-        /// <param name="ConstrSubPersonCode"></param>
-        /// <param name="ConstructionInstructor"></param>
-        /// <returns></returns>
-        private bool CheckPermission(int DepartmentCode, int ConstructionPersonCode, int ConstrSubPersonCode, int ConstructionInstructor)
+        private bool CheckPermission(DepositOrderer depositOrderer)
         {
-            // すべて表示させる
-            return true;
+            if (depositOrderer.RequestMonth == 0)
+            {
+                return false;
+            }
+            var ioRH = new IORequestHead();
+            var SalesDepCodeData = 0;
+            var SalesPersonCodeData = 0;
+            var SalesSubDepCodeData = 0;
+            var SalesSubPersonCodeData = 0;
+            var ConstrDepCodeData = 0;
+            var ConstructionPersonCodeData = 0;
+            var ConstrSubDepCodeData = 0;
+            var ConstrSubPersonCodeData = 0;
+            var ConstrInstrDepCodeData = 0;
+            var ConstructionInstructorData = 0;
+            var InvoiceNoData = 0;
+            bool InvoiceNoDataCheck = false;
+            try
+            {
+                var data = new ArrayList();
+                var sql = new StringBuilder();
 
-            #region 表示権限
-            //var ioPdm = new IOMPersonDepartment();
+                sql.Append(" SELECT ");
+                sql.Append("   SALESDEPCODE ");
+                sql.Append("   , SALESPERSONCODE ");
+                sql.Append("   , SALESSUBDEPCODE ");
+                sql.Append("   , SALESSUBPERSONCODE ");
+                sql.Append("   , CONSTRDEPCODE ");
+                sql.Append("   , CONSTRUCTIONPERSONCODE ");
+                sql.Append("   , CONSTRSUBDEPCODE ");
+                sql.Append("   , CONSTRSUBPERSONCODE ");
+                sql.Append("   , CONSTRINSTRDEPCODE ");
+                sql.Append("   , CONSTRUCTIONINSTRUCTOR  ");
+                sql.Append("   , I.INVOICENO  ");
+                sql.Append(" FROM ");
+                sql.Append("   REQUESTHEAD AS H  ");
+                sql.Append("   INNER JOIN CONSTRUCTIONBASEINFO AS CBI  ");
+                sql.Append("     ON CBI.ConstructionCode = H.REQCONSTRUCTIONCODE  ");
+                sql.Append("   LEFT OUTER JOIN INVOICEDATA AS I  ");
+                sql.Append("     ON I.INVOICENO = H.INVOICENO  ");
+                sql.Append(" WHERE ");
+                sql.AppendFormat("   H.REQUESTMONTH = {0} ", depositOrderer.RequestMonth);
+                sql.AppendFormat("   AND H.ORDERERSDIVISION = {0} ", depositOrderer.OrderersDivision);
+                sql.AppendFormat("   AND H.ORDERERSCODE = {0}; ", depositOrderer.OrderersCode);
+                if (!ioRH.ExecuteReader(sql.ToString(), ref data))
+                {
+                    return false;
+                }
 
-            //try
-            //{
-            //    // 全部署対象
-            //    if (m_UserInfo.m_SecRange == ClsSecurityPermission.SecRangeType.AllDepartment)
-            //    {
-            //        return true;
-            //    }
+                // 請求書が作成されていないデータは非表示にする
+                foreach (object[] work in data)
+                {
+                    InvoiceNoData = CommonMotions.cnvInt(work[10]);
+                    if (InvoiceNoData != 0)
+                    {
+                        InvoiceNoDataCheck = true;
+                    }
+                }
+                if (!InvoiceNoDataCheck)
+                {
+                    return false;
+                }
 
-            //    // 複数部署対象、または自部署のみ対象
-            //    else if ((m_UserInfo.m_SecRange == ClsSecurityPermission.SecRangeType.MultiDepartment) || (m_UserInfo.m_SecRange == ClsSecurityPermission.SecRangeType.OneDepartment))
-            //    {
-            //        var arDataPdm = new ArrayList();
-            //        var sql = new StringBuilder();
-            //        sql.AppendLine("select Pdm.DepartmentCode ");
-            //        sql.AppendLine("from PersonDepartmentMaster as Pdm ");
-            //        sql.AppendFormat("where Pdm.PersonCode = {0} ", CommonMotions.LoginUserData.PersonCode);
-            //        if (m_UserInfo.m_SecRange == ClsSecurityPermission.SecRangeType.OneDepartment)
-            //        {
-            //            sql.AppendLine("and Pdm.AffiliationFlg = 1 ");
-            //        }
-            //        if (!ioPdm.ExecuteReader(sql.ToString(), ref arDataPdm))
-            //            return false;
-            //        foreach (object[] work in arDataPdm)
-            //        {
-            //            if (CommonMotions.cnvInt(work[0]) == DepartmentCode)
-            //            {
-            //                return true;
-            //            }
-            //        }
-            //        return false;
-            //    }
-            //    // 担当分のみ対象
-            //    else
-            //    {
-            //        if ((CommonMotions.LoginUserData.PersonCode == ConstructionPersonCode) ||
-            //            (CommonMotions.LoginUserData.PersonCode == ConstrSubPersonCode) ||
-            //            (CommonMotions.LoginUserData.PersonCode == ConstructionInstructor))
-            //        {
-            //            return true;
-            //        }
-            //        else
-            //        {
-            //            return false;
-            //        }
-            //    }
-            //}
-            //catch (Exception ex)
-            //{
-            //    logger.ErrorFormat("システムエラー：{0}：{1}", CommonMotions.GetMethodName(), ex.Message);
-            //    return false;
-            //}
-            //finally
-            //{
-            //    ioPdm.close();
-            //    ioPdm = null;
-            //}
-            #endregion
+                // 請求書が作成いるデータで権限を確認する
+                foreach (object[] work in data)
+                {
+                    SalesDepCodeData = CommonMotions.cnvInt(work[0]);
+                    SalesPersonCodeData = CommonMotions.cnvInt(work[1]);
+                    SalesSubDepCodeData = CommonMotions.cnvInt(work[2]);
+                    SalesSubPersonCodeData = CommonMotions.cnvInt(work[3]);
+                    ConstrDepCodeData = CommonMotions.cnvInt(work[4]);
+                    ConstructionPersonCodeData = CommonMotions.cnvInt(work[5]);
+                    ConstrSubDepCodeData = CommonMotions.cnvInt(work[6]);
+                    ConstrSubPersonCodeData = CommonMotions.cnvInt(work[7]);
+                    ConstrInstrDepCodeData = CommonMotions.cnvInt(work[8]);
+                    ConstructionInstructorData = CommonMotions.cnvInt(work[9]);
+
+                    // 特別権限と総務は表示
+                    if (CommonMotions.LoginUserData.DepartmentCode == CommonDefine.s_GeneralAffairsDevision ||
+                            m_UserInfo.m_Type == CommonDefine.SecurityRankPos.SpecialAuthority)
+                    {
+                        return true;
+                    }
+                    // 複数部署対象、または自部署のみ対象
+                    else if ((m_UserInfo.m_SecRange == ClsSecurityPermission.SecRangeType.MultiDepartment) ||
+                        (m_UserInfo.m_SecRange == ClsSecurityPermission.SecRangeType.OneDepartment))
+                    {
+                        if (CommonMotions.LoginUserData.DepartmentCode == SalesDepCodeData ||
+                            CommonMotions.LoginUserData.DepartmentCode == SalesSubDepCodeData ||
+                            CommonMotions.LoginUserData.DepartmentCode == ConstrDepCodeData ||
+                            CommonMotions.LoginUserData.DepartmentCode == ConstrSubDepCodeData ||
+                            CommonMotions.LoginUserData.DepartmentCode == ConstrInstrDepCodeData)
+                        {
+                            return true;
+                        }
+                    }
+                    // 自分の担当の場合は表示
+                    else if (CommonMotions.LoginUserData.PersonCode == SalesPersonCodeData ||
+                        CommonMotions.LoginUserData.PersonCode == SalesSubPersonCodeData ||
+                        CommonMotions.LoginUserData.PersonCode == ConstructionPersonCodeData ||
+                    CommonMotions.LoginUserData.PersonCode == ConstrSubPersonCodeData ||
+                    CommonMotions.LoginUserData.PersonCode == ConstructionInstructorData)
+                    {
+                        return true;
+                    }
+                }
+                
+                return false;
+            }
+            catch (Exception ex)
+            {
+                logger.ErrorFormat("システムエラー：{0}：{1}", CommonMotions.GetMethodName(), ex.Message);
+                return false;
+            }
+            finally
+            {
+                ioRH.close();
+                ioRH = null;
+            }
         }
         #endregion
 
@@ -2005,32 +2420,43 @@
         /// <returns></returns>
         private bool CanEditDepositDetail(DepositDetail depositDetail)
         {
-            // 担当者、副担当、指導員の場合
-            if (CommonMotions.LoginUserData.PersonCode == depositDetail.ConstructionPersonCode ||
-                CommonMotions.LoginUserData.PersonCode == depositDetail.ConstrSubPersonCode ||
-                CommonMotions.LoginUserData.PersonCode == depositDetail.ConstructionInstructor)
+
+            // 承認済みなら編集不可
+            if (depositDetail.ConfirmationEndFlg == 1)
             {
-                // 承認済みなら編集不可
-                if (depositDetail.ConfirmationEndFlg == 1)
-                {
-                    return false;
-                }
+                return false;
+            }
+            // 特別権限の場合
+            else if (m_UserInfo.m_Type == CommonDefine.SecurityRankPos.SpecialAuthority)
+            {
                 return true;
             }
-            // 所属長、統括者の場合
-            else if (m_UserInfo.m_Type == CommonDefine.SecurityRankPos.LimitedAuthority || m_UserInfo.m_Type == CommonDefine.SecurityRankPos.FreeAuthority)
+            else
             {
-                // 上属の上長でなければ編集不可
-                if ((int)CommonMotions.LoginUserData.DepartmentCode != depositDetail.DepartmentCode)
+                // 担当者、副担当、指導員の場合
+                if (CommonMotions.LoginUserData.PersonCode == depositDetail.ConstructionPersonCode ||
+                    CommonMotions.LoginUserData.PersonCode == depositDetail.ConstrSubPersonCode ||
+                    CommonMotions.LoginUserData.PersonCode == depositDetail.ConstructionInstructor)
                 {
-                    return false;
+                    return true;
                 }
+
+                // 総務の場合は編集可能
+                else if (CommonMotions.LoginUserData.DepartmentCode == CommonDefine.s_GeneralAffairsDevision)
+                {
+                    return true;
+                }
+
+                // 所属長、統括者の場合
+                else if (m_UserInfo.m_Type == CommonDefine.SecurityRankPos.LimitedAuthority || m_UserInfo.m_Type == CommonDefine.SecurityRankPos.FreeAuthority)
+                {
+                    // 上属の上長でなければ編集不可
+                    if ((int)CommonMotions.LoginUserData.DepartmentCode != depositDetail.DepartmentCode)
+                    {
+                        return false;
+                    }
+                }
             }
-            // 特別権限の場合
-            else if (m_UserInfo.m_Type == CommonDefine.SecurityRankPos.SpecialAuthority)
-            {
-                return true;
-            }
             return false;
         }
         #endregion
@@ -2148,6 +2574,10 @@
             {
                 dgvMaster.Columns[i].Visible = true;
             }
+            for(int p=0; p < dgvMaster.RowCount; p++)
+            {
+                dgvMaster.Rows[p].Visible = true;
+            }
         }
         #endregion
 
@@ -2167,7 +2597,8 @@
                 return;
             }
 
-            if ((tcol == (int)DispColumn.DepositAmount) ||                  // 入金金額
+            if ((tcol == (int)DispColumn.DepositAmount) ||                  // 入金金額(税抜)
+               (tcol == (int)DispColumn.TaxAmount) ||                  // 入金金額（消費税）
                (tcol == (int)DispColumn.DiscountAmount) ||                  // 値引金額
                (tcol == (int)DispColumn.CnstrPrice) ||                      // 協力金
                (tcol == (int)DispColumn.Fees) ||                            // 手数料
@@ -2232,6 +2663,7 @@
                     return;
                 }
                 else if (e.ColumnIndex == (int)DispColumn.DepositAmount
+                    || e.ColumnIndex == (int)DispColumn.TaxAmount
                     || e.ColumnIndex == (int)DispColumn.DiscountAmount
                     || e.ColumnIndex == (int)DispColumn.CnstrPrice
                     || e.ColumnIndex == (int)DispColumn.Fees
@@ -2259,5 +2691,49 @@
 
         }
         #endregion
+
+        #region グリッドマウス集計処理
+        /// <summary>
+        /// グリッドマウス集計処理
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void DataGridView_MouseUp(object sender, MouseEventArgs e)
+        {
+            try
+            {
+                DataGridViewEX dgv = (DataGridViewEX)sender;
+
+                lblCellTotal.Text = string.Empty;
+
+                double dTotal = 0;
+                int DataCnt = 0;
+                int NumericCnt = 0;
+                foreach (DataGridViewCell c in dgv.SelectedCells)
+                {
+                    if (CommonMotions.chkObjectIsNull(dgv.Rows[c.RowIndex].Cells[c.ColumnIndex])) continue;
+                    if (CommonMotions.chkCellBlank(dgv.Rows[c.RowIndex].Cells[c.ColumnIndex].Value)) continue;
+
+                    //Console.WriteLine("{0}, {1}", c.ColumnIndex, c.RowIndex);
+                    DataCnt++;
+                    dTotal += CommonMotions.cnvDouble(dgv.Rows[c.RowIndex].Cells[c.ColumnIndex].Value);
+                    if (CommonMotions.chkNumeric(dgv.Rows[c.RowIndex].Cells[c.ColumnIndex].Value)) NumericCnt++;
+                }
+                if (DataCnt <= 1 || dTotal == 0 || NumericCnt == 0) return;
+                string strTotal = CommonMotions.cnvTruncate(dTotal).ToString("#,#");
+                if (dTotal - System.Math.Floor(dTotal) != 0) strTotal = dTotal.ToString("#,#.00");
+
+                string strwrkData = string.Format(CommonDefine.s_CalculateCellFormat,
+                                                    CommonMotions.cnvTruncate(dTotal / (double)NumericCnt).ToString("#,#"),
+                                                    DataCnt.ToString("#,#"),
+                                                    strTotal);
+                lblCellTotal.Text = strwrkData;
+            }
+            catch (Exception ex)
+            {
+                logger.ErrorFormat("システムエラー：{0}：{1}", CommonMotions.GetMethodName(), ex.Message);
+            }
+        }
+        #endregion
     }
 }
Index: trunk/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Request/SelectPayment/FrmSelectPayment.resx
===================================================================
--- trunk/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Request/SelectPayment/FrmSelectPayment.resx	(revision 384)
+++ trunk/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Request/SelectPayment/FrmSelectPayment.resx	(revision 385)
@@ -117,6 +117,9 @@
   <resheader name="writer">
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
+  <metadata name="KB.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
   <metadata name="No.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
@@ -159,6 +162,9 @@
   <metadata name="DepositAmount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <metadata name="TaxAmount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
   <metadata name="DiscountAmount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
