Index: branches/ddl/CreateBilling/CreateBilling/CreateBilling.csproj
===================================================================
--- branches/ddl/CreateBilling/CreateBilling/CreateBilling.csproj	(revision 229)
+++ branches/ddl/CreateBilling/CreateBilling/CreateBilling.csproj	(revision 230)
@@ -337,6 +337,9 @@
     <Compile Include="..\..\ProcessManagement\ProcessManagement\DataModel\RequestHead.cs">
       <Link>DataModel\RequestHead.cs</Link>
     </Compile>
+    <Compile Include="..\..\ProcessManagement\ProcessManagement\DataModel\RequestOrderDate.cs">
+      <Link>DataModel\RequestOrderDate.cs</Link>
+    </Compile>
     <Compile Include="..\..\ProcessManagement\ProcessManagement\DataModel\SalesGraphData.cs">
       <Link>DataModel\SalesGraphData.cs</Link>
     </Compile>
@@ -700,6 +703,9 @@
     <Compile Include="..\..\ProcessManagement\ProcessManagement\DB\IOAccess\IORequestHead.cs">
       <Link>DB\IOAccess\IORequestHead.cs</Link>
     </Compile>
+    <Compile Include="..\..\ProcessManagement\ProcessManagement\DB\IOAccess\IORequestOrderDate.cs">
+      <Link>DB\IOAccess\IORequestOrderDate.cs</Link>
+    </Compile>
     <Compile Include="..\..\ProcessManagement\ProcessManagement\DB\IOAccess\IOSalesGraphData.cs">
       <Link>DB\IOAccess\IOSalesGraphData.cs</Link>
     </Compile>
Index: branches/ddl/CreateBilling/CreateBilling/CreateBillingDataAux.cs
===================================================================
--- branches/ddl/CreateBilling/CreateBilling/CreateBillingDataAux.cs	(revision 229)
+++ branches/ddl/CreateBilling/CreateBilling/CreateBillingDataAux.cs	(revision 230)
@@ -185,39 +185,41 @@
         {
             try
             {
-                string strRet = "select B.*,";
-                strRet += " E.DetailString,";           // 0
-                strRet += " D.DetailString,";           // 1
-                strRet += " C.JoinFlg,";                // 2
-                strRet += " C.TyingFlg,";               // 3
-                strRet += " C.BillingDate,";            // 4
-                strRet += " C.BillingSplitFlg,";        // 5
-                strRet += " C.OrderersDivision,";       // 6
-                strRet += " C.OrderersCode,";           // 7
-                strRet += " A.OrdersDecisionPrice,";    // 8
-                strRet += " C.ConstructionPersonCode";  // 9
+                StringBuilder strRet = new StringBuilder();
+                strRet.Append("select B.*,");
+                strRet.Append(" E.DetailString,");           // 0
+                strRet.Append(" D.DetailString,");           // 1
+                strRet.Append(" C.JoinFlg,");                // 2
+                strRet.Append(" C.TyingFlg,");               // 3
+                strRet.Append(" C.BillingDate,");            // 4
+                strRet.Append(" C.BillingSplitFlg,");        // 5
+                strRet.Append(" C.OrderersDivision,");       // 6
+                strRet.Append(" C.OrderersCode,");           // 7
+                strRet.Append(" A.OrdersDecisionPrice,");    // 8
+                strRet.Append(" C.ConstructionPersonCode");  // 9
 
-                strRet += " FROM";
-                strRet += " constructionledger AS A,";
-                strRet += " constructionledgerexcute AS B,";
-                strRet += " constructionbaseinfo AS C,";
-                strRet += " constructionbaseinfodetail AS D,";
-                strRet += " constructionbaseinfodetail AS E";
+                strRet.Append(" FROM");
+                strRet.Append(" constructionledger AS A,");
+                strRet.Append(" constructionledgerexcute AS B,");
+                strRet.Append(" constructionbaseinfo AS C,");
+                strRet.Append(" constructionbaseinfodetail AS D,");
+                strRet.Append(" constructionbaseinfodetail AS E");
 
-                strRet += " WHERE";
-                strRet += " A.ConstructionPeriod = 16";
-                strRet += " AND B.ConstructionCode = A.ConstructionCode";
-                strRet += " AND B.GroupCount = 14";
-                strRet += " AND C.ConstructionCode = A.ConstructionCode";
-                strRet += " AND D.ConstructionCode = A.ConstructionCode";
-                strRet += string.Format(" AND D.DetailNo = {0}", (int)ConstructionBaseInfoDetail.DetailDataNo.ConstructionName);
-                strRet += " AND E.ConstructionCode = A.ConstructionCode";
-                strRet += string.Format(" AND E.DetailNo = {0}", (int)ConstructionBaseInfoDetail.DetailDataNo.OrderersName);
+                strRet.Append(" WHERE");
+                // strRet.Append(" A.ConstructionPeriod = 16");
+                // strRet.Append(" AND B.ConstructionCode = A.ConstructionCode");
+                strRet.Append(" B.ConstructionCode = A.ConstructionCode");
+                strRet.Append(" AND B.GroupCount = 14");
+                strRet.Append(" AND C.ConstructionCode = A.ConstructionCode");
+                strRet.Append(" AND D.ConstructionCode = A.ConstructionCode");
+                strRet.AppendFormat(" AND D.DetailNo = {0}", (int)ConstructionBaseInfoDetail.DetailDataNo.ConstructionName);
+                strRet.Append(" AND E.ConstructionCode = A.ConstructionCode");
+                strRet.AppendFormat(" AND E.DetailNo = {0}", (int)ConstructionBaseInfoDetail.DetailDataNo.OrderersName);
 
-                strRet += " order by B.ConstructionCode, B.LineCount, B.ColumnCount";
+                strRet.Append(" order by B.ConstructionCode, B.LineCount, B.ColumnCount");
 
 
-                return strRet;
+                return strRet.ToString();
             }
             catch (Exception ex)
             {
@@ -243,6 +245,7 @@
             IOMApproval ApprovalMastDB = new IOMApproval();
             IOProcessApproval AppDB = new IOProcessApproval();
             IORequestOrderDate ReqDateDB = new IORequestOrderDate();
+            IOConstructionBaseInfo BaseDB = new IOConstructionBaseInfo();
             strMsg = "請求データ作成";
             try
             {
@@ -259,8 +262,9 @@
                 ApprovalMastDB.connect(); ApprovalMastDB.beginTran();
                 AppDB.connect(); AppDB.beginTran();
                 ReqDateDB.connect(); ReqDateDB.beginTran();
+                BaseDB.connect(); BaseDB.beginTran();
 
-                string strOrderSQL = string.Empty;
+                StringBuilder strOrderSQL = new StringBuilder();
                 int nTargetmonth = 0;
                 int nRequestNo = 0;
                 int nInvoiceNo = 0;
@@ -286,10 +290,11 @@
                     nInvoiceNo = InvoiceDB.NumberingInvoiceNo(nTargetmonth, false);
 
                     // 受付番号
-                    strOrderSQL = "select count(*) from requesthead";
-                    strOrderSQL += string.Format(" where ReqConstructionCode = {0}", InRec.ConstructionCode);
+                    strOrderSQL.Clear();
+                    strOrderSQL.Append("select count(*) from requesthead");
+                    strOrderSQL.AppendFormat(" where ReqConstructionCode = {0}", InRec.ConstructionCode);
                     ArrayList arData = new ArrayList();
-                    if (!HeadDB.ExecuteReader(strOrderSQL, ref arData, false)) return false;
+                    if (!HeadDB.ExecuteReader(strOrderSQL.ToString(), ref arData, false)) return false;
                     obiWork = (object[])arData[0];
                     nOrderNo = CommonMotions.cnvInt(obiWork[0]) + 1;
 
@@ -310,6 +315,8 @@
                     // 請求書日付データ作成
                     if (!(bcommit = CreateRequestOrderDate(ReqDateDB, objRec, InRec, nInvoiceNo, nOrderNo, nTargetmonth, ref strMsg))) break;
                 }
+                // 請求回数フラグ更新
+                bcommit = UpdateBaseInfoBillingSplitFlg(HeadDB,BaseDB, ref  strMsg);
 
                 if (!bcommit)
                 {
@@ -321,6 +328,7 @@
                     DepositDDB.rollback();
                     AppDB.rollback();
                     ReqDateDB.rollback();
+                    BaseDB.rollback();
                 }
 
                 return true;
@@ -335,6 +343,7 @@
                 DepositDDB.rollback();
                 AppDB.rollback();
                 ReqDateDB.rollback();
+                BaseDB.rollback();
 
                 logger.ErrorFormat("システムエラー：{0}：{1}", CommonMotions.GetMethodName(), ex.Message);
                 strMsg += string.Format("　システムエラー：{0}：{1}", CommonMotions.GetMethodName(), ex.Message);
@@ -353,6 +362,7 @@
                 DepositDDB.commit();
                 AppDB.commit();
                 ReqDateDB.commit();
+                BaseDB.commit();
 
                 HeadDB.close(); HeadDB = null;
                 DataDB.close(); DataDB = null;
@@ -362,6 +372,7 @@
                 DepositDDB.close(); DepositDDB = null;
                 AppDB.close(); AppDB = null;
                 ReqDateDB.close(); ReqDateDB = null;
+                BaseDB.close(); BaseDB = null;
             }
         }
         #endregion
@@ -829,5 +840,68 @@
             }
         }
         #endregion
+
+        #region 請求回数フラグ更新
+        /// <summary>
+        /// 請求回数フラグ更新
+        /// </summary>
+        /// <param name="BaseDB"></param>
+        /// <param name="strMsg"></param>
+        /// <returns></returns>
+        private bool UpdateBaseInfoBillingSplitFlg(IORequestHead HeadDB,
+                                                    IOConstructionBaseInfo BaseDB,
+                                                    ref string strMsg)
+        {
+            try
+            {
+                StringBuilder strSQL = new StringBuilder();
+                strSQL.Append("select A.REQCONSTRUCTIONCODE, count(*) as Dcnt");
+                strSQL.Append(" from requesthead as A, constructionledger as B");
+                strSQL.Append(" where B.ConstructionCode = A.REQCONSTRUCTIONCODE");
+                strSQL.Append(" group by REQCONSTRUCTIONCODE");
+                strSQL.Append(" order by Dcnt, REQCONSTRUCTIONCODE");
+
+                ArrayList arList = new ArrayList();
+                HeadDB.ExecuteReader(strSQL.ToString(), ref arList, false);
+
+                int ConstrCode = 0;
+                int DataCnt = 0;
+                foreach (object[] objRec in arList)
+                {
+                    ConstrCode = CommonMotions.cnvInt(objRec[0]);
+                    DataCnt = CommonMotions.cnvInt(objRec[1]);
+
+                    if (DataCnt > 1)
+                    {
+                        if(!BaseDB.UpdateFeild(ConstrCode,
+                                            (int)IOConstructionBaseInfo.TableColumn.BillingSplitFlg,
+                                            (int)CommonDefine.BaseInfoBillingSplitFlg.SplitBilling,
+                                            false))
+                        {
+                            return false;
+                        }
+                    }
+                    else
+                    {
+                        if (!BaseDB.UpdateFeild(ConstrCode,
+                                            (int)IOConstructionBaseInfo.TableColumn.BillingSplitFlg,
+                                            (int)CommonDefine.BaseInfoBillingSplitFlg.AllOnBilling,
+                                            false))
+                        {
+                            return false;
+                        }
+                    }
+                }
+
+                return true;
+            }
+            catch (Exception ex)
+            {
+                logger.ErrorFormat("システムエラー：{0}：{1}", CommonMotions.GetMethodName(), ex.Message);
+                strMsg += string.Format("　システムエラー：{0}：{1}", CommonMotions.GetMethodName(), ex.Message);
+                return false;
+            }
+        }
+        #endregion
     }
 }
