プロジェクト

全般

プロフィール

リビジョン 195

堀内7年以上前に追加

不要クラス削除
StringBuilder化

差分を表示:

branches/src/DataCheckExcute/DataCheckExcute/Common/Process/ClsChangeLedgerData.cs
58 58
        {
59 59
            try
60 60
            {
61
                string strSQL = string.Empty;
61
                StringBuilder strSQL = new StringBuilder();
62 62
                bool bRet = true;
63 63
                foreach (int ConstrCode in ConstrCodeList)
64 64
                {
65 65
                    // 工事台帳実行データよりグループごとの合計金額を取得する
66
                    strSQL = "SELECT GROUPCOUNT, SUM(PAYMENTAMOUNT)";
67
                    strSQL += " FROM CONSTRUCTIONLEDGEREXCUTE";
68
                    strSQL += string.Format(" WHERE CONSTRUCTIONCODE = {0}", ConstrCode);
69
                    strSQL += " GROUP BY GROUPCOUNT";
70
                    strSQL += " ORDER BY GROUPCOUNT";
66
                    strSQL.Append("SELECT GROUPCOUNT, SUM(PAYMENTAMOUNT)");
67
                    strSQL.Append(" FROM CONSTRUCTIONLEDGEREXCUTE");
68
                    strSQL.AppendFormat(" WHERE CONSTRUCTIONCODE = {0}", ConstrCode);
69
                    strSQL.Append(" GROUP BY GROUPCOUNT");
70
                    strSQL.Append(" ORDER BY GROUPCOUNT");
71 71

  
72 72
                    ArrayList InData = new ArrayList();
73
                    if (!LedgerExcuteDB.ExecuteReader(strSQL, ref InData, false)) continue;
73
                    if (!LedgerExcuteDB.ExecuteReader(strSQL.ToString(), ref InData, false)) continue;
74 74

  
75 75
                    // データ無は次のデータ
76 76
                    if (InData.Count == 0) continue;
......
104 104
                    int Billing = CalcGetTotal(InData, GroupCodeList);                              // ----- 請求額
105 105

  
106 106
                    // ----- 工事詳細台帳更新
107
                    strSQL = "UPDATE CONSTRUCTIONLEDGER SET";
108
                    strSQL += string.Format(" TOTALPAYMENT = {0}", Payment);
109
                    strSQL += string.Format(" , GROSSPROFIT = {0}", (Billing - Payment));
110
                    strSQL += string.Format(" , Allowance = {0}", Allowance);
111
                    strSQL += string.Format(" , NETPROFIT = {0}", (Billing - (Payment + Allowance + PExpenses)));
112
                    strSQL += string.Format(" WHERE CONSTRUCTIONCODE = {0}", ConstrCode);
113
                    if (!LedgerExcuteDB.ExecuteNonQuery(strSQL, false))
107
                    strSQL.Clear();
108
                    strSQL.Append("UPDATE CONSTRUCTIONLEDGER SET");
109
                    strSQL.AppendFormat(" TOTALPAYMENT = {0}", Payment);
110
                    strSQL.AppendFormat(" , GROSSPROFIT = {0}", (Billing - Payment));
111
                    strSQL.AppendFormat(" , Allowance = {0}", Allowance);
112
                    strSQL.AppendFormat(" , NETPROFIT = {0}", (Billing - (Payment + Allowance + PExpenses)));
113
                    strSQL.AppendFormat(" WHERE CONSTRUCTIONCODE = {0}", ConstrCode);
114
                    if (!LedgerExcuteDB.ExecuteNonQuery(strSQL.ToString(), false))
114 115
                    {
115 116
                        bRet = false;
116 117
                        break;
......
198 199
                LedgerExDB.connect(); LedgerExDB.beginTran();
199 200
                PersonDB.connect(); PersonDB.beginTran();
200 201

  
202
                StringBuilder DetailSQL = new StringBuilder();
201 203
                foreach (ConstructionLedger LedgerRec in LedgerList)
202 204
                {
203 205

  
204 206
                    // 工事詳細台帳明細データ取得
205 207
                    List<ConstructionLedgerDetail> DetailList = new List<ConstructionLedgerDetail>();
206
                    string DetailSQL = LedgerDeDB.CreatePrimarykeyString(LedgerRec.ConstructionCode);
207
                    DetailSQL += string.Format(" AND OperatingFlg = {0}", (int)CommonDefine.SalaryOperateKind.Oparateing);  // 対応中フラグ
208
                    DetailSQL += string.Format(" AND SALARYFLG != {0}", (int)CommonDefine.SalaryDevision.Noting);           // 給与振分区分
209
                    DetailSQL += string.Format(" AND GROUPCOUNT IN ({0},{1},{2})",
208
                    DetailSQL.Clear();
209
                    DetailSQL.Append(LedgerDeDB.CreatePrimarykeyString(LedgerRec.ConstructionCode));
210
                    DetailSQL.AppendFormat(" AND OperatingFlg = {0}", (int)CommonDefine.SalaryOperateKind.Oparateing);  // 対応中フラグ
211
                    DetailSQL.AppendFormat(" AND SALARYFLG != {0}", (int)CommonDefine.SalaryDevision.Noting);           // 給与振分区分
212
                    DetailSQL.AppendFormat(" AND GROUPCOUNT IN ({0},{1},{2})",
210 213
                                                                    (int)FrmConstructionLedger.DataGroup.Instructor,        // 指導員給料
211 214
                                                                    (int)FrmConstructionLedger.DataGroup.Assistant,         // 副担当者給料
212 215
                                                                    (int)FrmConstructionLedger.DataGroup.Payroll);          // 担当者給料行
213 216

  
214
                    if (!LedgerDeDB.SelectAction(DetailSQL, ref DetailList, false) || DetailList.Count == 0) continue;
217
                    if (!LedgerDeDB.SelectAction(DetailSQL.ToString(), ref DetailList, false) || DetailList.Count == 0) continue;
215 218

  
216 219
                    DateTime TargetDate = DateTime.Now.Date;
217 220
                    // 対象月より書込みカラム位置を取得する
......
226 229
                        // 施工管理中担当者ではない場合は処理しない
227 230
                        if (CurRec.OperatingFlg == (int)CommonDefine.SalaryOperateKind.Complate) continue;
228 231

  
229
                        //if (LedgerRec.ConstructionCode == 2016043601)
230
                        //{
231
                        //    Debug.WriteLine("stop");
232
                        //}
233

  
234 232
                        // セットする金額を計算する
235 233
                        switch (CurRec.SalaryFlg)
236 234
                        {
......
488 486
            try
489 487
            {
490 488
                // キー作成
491
                string strSQL = LedgerExDB.CreatePrimarykeyString(ConstrCode, GroupCount, LineCount, ColumnCount);
492
                strSQL += string.Format(" AND DATE(TargetMonth) = STR_TO_DATE('{0}','%Y/%m/%d')", ColumnDate.ToShortDateString());
489
                StringBuilder strSQL = new StringBuilder();
490
                strSQL.Append(LedgerExDB.CreatePrimarykeyString(ConstrCode, GroupCount, LineCount, ColumnCount));
491
                strSQL.AppendFormat(" AND DATE(TargetMonth) = STR_TO_DATE('{0}','%Y/%m/%d')", ColumnDate.ToShortDateString());
493 492

  
494 493
                // データ読込み
495 494
                List<ConstructionLedgerExcute> LedgerExDBList = new List<ConstructionLedgerExcute>();
496 495
                ConstructionLedgerExcute LedgerExDBRec = new ConstructionLedgerExcute();
497
                bool ReadData = LedgerExDB.SelectAction(strSQL, ref LedgerExDBList, false);
496
                bool ReadData = LedgerExDB.SelectAction(strSQL.ToString(), ref LedgerExDBList, false);
498 497
                if (!ReadData || LedgerExDBList.Count == 0)
499 498
                {
500 499
                    LedgerExDBRec.ConstructionCode = ConstrCode;	// 工事コード
......
512 511

  
513 512
                // データ更新
514 513
                if (!LedgerExDB.UpdateFeild(ConstrCode, GroupCount, LineCount, ColumnCount
515
                                            , (int)IOConstructionLedgerExcute.TableColumn.PaymentAmount, DaySalary, false)) return false;
514
                                            , (int)IOConstructionLedgerExcute.TableColumn.PaymentAmount, (double)DaySalary, false)) return false;
516 515

  
517 516
                return true;
518 517
            }
branches/src/DataCheckExcute/DataCheckExcute/Common/Process/ClsSystemOnceExecute.cs
395 395
            IOMessageBoardData mbdDB = new IOMessageBoardData();
396 396
            IOMessageBoardTerget mbtDB = new IOMessageBoardTerget();
397 397

  
398
            string strSQL = "SELECT";
399
            strSQL += " t1.MaterialItemCode";
400
            strSQL += ", t1.ProcessDate";
401
            strSQL += ", t1.SeqNo";
402
            strSQL += ", t1.RecKind";
403
            strSQL += ", t1.ConstructionCode";
404
            strSQL += ", t1.PersonCode";
405
            strSQL += ", t1.MaterialCount";
406
            strSQL += ", MAX(t1.REPAYPLANDATE) AS RepayPlanDate";
407
            strSQL += ", t1.CommentText";
408
            strSQL += ", t1.EntryDate";
409
            strSQL += ", t1.UpdateDate";
410
            strSQL += " FROM";
411
            strSQL += " MATERIALRECORDINFO AS t1";
412
            strSQL += " INNER JOIN CONSTRUCTIONMATERIALINFO AS t2";
413
            strSQL += " ON t1.CONSTRUCTIONCODE = t2.CONSTRUCTIONCODE";
414
            strSQL += " AND t1.MATERIALITEMCODE = t2.MATERIALITEMCODE";
415
            strSQL += " AND t2.COMPLETEFLG = 0";
416
            strSQL += " WHERE";
417
            strSQL += " t1.CONSTRUCTIONCODE > 0";
418
            strSQL += " AND t1.CONSTRUCTIONCODE IS NOT NULL";
419
            strSQL += " AND t1.RECKIND = 0";
420
            strSQL += " AND t1.REPAYPLANDATE <= DATE_FORMAT(NOW(), '%Y/%m/%d')";
421
            strSQL += " GROUP BY";
422
            strSQL += " t1.CONSTRUCTIONCODE";
423
            strSQL += ", t1.PERSONCODE";
424
            strSQL += " ORDER BY";
425
            strSQL += " t1.CONSTRUCTIONCODE";
426
            strSQL += " , t1.REPAYPLANDATE";
398
            StringBuilder strSQL = new StringBuilder();
427 399

  
428 400
            try
429 401
            {
......
434 406

  
435 407
                bool procflg = true;
436 408

  
409
                CreateGetMaterialDataSQL(ref strSQL);
410

  
437 411
                // 資材履歴情報の返却未完了の貸出データを取得する
438 412
                IOMaterialRecordInfo mrDB = new IOMaterialRecordInfo();
439 413
                ArrayList mrData = new ArrayList();
440 414
                List<MaterialRecordInfo> data = new List<MaterialRecordInfo>();
441 415

  
442
                if (mrDB.ExecuteReader(strSQL, ref mrData))
416
                if (mrDB.ExecuteReader(strSQL.ToString(), ref mrData))
443 417
                {
444 418
                    foreach (object[] objwrk in mrData)
445 419
                    {
446 420
                        MaterialRecordInfo wrkRec = new MaterialRecordInfo();
447 421
                        mrDB.Reader2Struct(objwrk, ref wrkRec);
422

  
448 423
                        // チェック
449 424
                        TermMaster term = new TermMaster();
450 425
                        MaterualStatusCheck(wrkRec, StartDate, ref term);
......
491 466
        }
492 467
        #endregion
493 468

  
469
        #region 資材返却チェックデータ取得SQL作成
470
        /// <summary>
471
        /// 資材返却チェックデータ取得SQL作成
472
        /// </summary>
473
        /// <param name="strSQL"></param>
474
        private void CreateGetMaterialDataSQL(ref StringBuilder strSQL)
475
        {
476
            try
477
            {
478
                strSQL.Append("SELECT");
479
                strSQL.Append(" t1.MaterialItemCode");
480
                strSQL.Append(", t1.ProcessDate");
481
                strSQL.Append(", t1.SeqNo");
482
                strSQL.Append(", t1.RecKind");
483
                strSQL.Append(", t1.ConstructionCode");
484
                strSQL.Append(", t1.PersonCode");
485
                strSQL.Append(", t1.MaterialCount");
486
                strSQL.Append(", MAX(t1.REPAYPLANDATE) AS RepayPlanDate");
487
                strSQL.Append(", t1.CommentText");
488
                strSQL.Append(", t1.EntryDate");
489
                strSQL.Append(", t1.UpdateDate");
490
                strSQL.Append(" FROM");
491
                strSQL.Append(" MATERIALRECORDINFO AS t1");
492
                strSQL.Append(" INNER JOIN CONSTRUCTIONMATERIALINFO AS t2");
493
                strSQL.Append(" ON t1.CONSTRUCTIONCODE = t2.CONSTRUCTIONCODE");
494
                strSQL.Append(" AND t1.MATERIALITEMCODE = t2.MATERIALITEMCODE");
495
                strSQL.Append(" AND t2.COMPLETEFLG = 0");
496
                strSQL.Append(" WHERE");
497
                strSQL.Append(" t1.CONSTRUCTIONCODE > 0");
498
                strSQL.Append(" AND t1.CONSTRUCTIONCODE IS NOT NULL");
499
                strSQL.Append(" AND t1.RECKIND = 0");
500
                strSQL.Append(" AND t1.REPAYPLANDATE <= DATE_FORMAT(NOW(), '%Y/%m/%d')");
501
                strSQL.Append(" GROUP BY");
502
                strSQL.Append(" t1.CONSTRUCTIONCODE");
503
                strSQL.Append(", t1.PERSONCODE");
504
                strSQL.Append(" ORDER BY");
505
                strSQL.Append(" t1.CONSTRUCTIONCODE");
506
                strSQL.Append(" , t1.REPAYPLANDATE");
507
            }
508
            catch (Exception ex)
509
            {
510
                logger.ErrorFormat("システムエラー:{0}", ex.Message);
511
            }
512
        }
513
        #endregion
514

  
494 515
        #region 工事情報チェック処理
495 516
        /// <summary>
496 517
        /// 日付の期限チェックを行う
......
504 525
            try
505 526
            {
506 527
                // 工事基本情報を期限テーブルに設定している状態分取得する
507
                string strSQL = " WHERE CONSTRUCTIONSTATUSFLG IN (SELECT DISTINCT A1.CONSTRUCTIONSTATUSFLG FROM TERMMASTER A1)";
508
                strSQL = " ORDER BY CONSTRUCTIONSTATUSFLG ASC, CONSTRUCTIONCODE ASC";
528
                StringBuilder strSQL = new StringBuilder();
529
                strSQL.Append(" WHERE CONSTRUCTIONSTATUSFLG IN (SELECT DISTINCT A1.CONSTRUCTIONSTATUSFLG FROM TERMMASTER A1)");
530
                strSQL.Append(" ORDER BY CONSTRUCTIONSTATUSFLG ASC, CONSTRUCTIONCODE ASC");
509 531
                List<ConstructionBaseInfo> cbiList = new List<ConstructionBaseInfo>();
510
                if (!cbiDB.SelectAction(strSQL, ref cbiList)) return true;
532
                if (!cbiDB.SelectAction(strSQL.ToString(), ref cbiList)) return true;
511 533

  
512 534
                // 経過日数を取得する
513 535
                TimeSpan ts = DateTime.Now - StartDate;
......
747 769
            try
748 770
            {
749 771
                // 工事名称・営業担当者・工事担当者取得
750
                string strSQL = "SELECT A.DETAILSTRING, B.PERSONCODE SCODE, B.PERSONNAME SNAME, C.PERSONCODE CCODE, C.PERSONNAME CNAME";
751
                strSQL += " FROM CONSTRUCTIONBASEINFO P";
752
                strSQL += " LEFT JOIN PERSONINCHARGEMASTER B ON B.PERSONCODE = P.SALESPERSONCODE";
753
                strSQL += " LEFT JOIN PERSONINCHARGEMASTER C ON C.PERSONCODE = P.CONSTRUCTIONPERSONCODE";
754
                strSQL += " , CONSTRUCTIONBASEINFODETAIL A";
755
                strSQL += string.Format(" WHERE P.CONSTRUCTIONCODE = {0}",wrkRec.ConstructionCode);
756
                strSQL += string.Format(" AND A.CONSTRUCTIONCODE = P.CONSTRUCTIONCODE AND A.DETAILNO = {0}", (int)ConstructionBaseInfoDetail.DetailDataNo.ConstructionName);
772
                StringBuilder strSQL = new StringBuilder();
773
                strSQL.Append("SELECT A.DETAILSTRING, B.PERSONCODE SCODE, B.PERSONNAME SNAME, C.PERSONCODE CCODE, C.PERSONNAME CNAME");
774
                strSQL.Append(" FROM CONSTRUCTIONBASEINFO P");
775
                strSQL.Append(" LEFT JOIN PERSONINCHARGEMASTER B ON B.PERSONCODE = P.SALESPERSONCODE");
776
                strSQL.Append(" LEFT JOIN PERSONINCHARGEMASTER C ON C.PERSONCODE = P.CONSTRUCTIONPERSONCODE");
777
                strSQL.Append(", CONSTRUCTIONBASEINFODETAIL A");
778
                strSQL.AppendFormat(" WHERE P.CONSTRUCTIONCODE = {0}",wrkRec.ConstructionCode);
779
                strSQL.AppendFormat(" AND A.CONSTRUCTIONCODE = P.CONSTRUCTIONCODE AND A.DETAILNO = {0}", (int)ConstructionBaseInfoDetail.DetailDataNo.ConstructionName);
757 780
                ArrayList arList = new ArrayList();
758
                if (!cbiDB.ExecuteReader(strSQL, ref arList)) return false;
781
                if (!cbiDB.ExecuteReader(strSQL.ToString(), ref arList)) return false;
759 782
                
760 783
                string DetailString = string.Empty;
761 784
                int SalesPersonCode = 0;
......
778 801

  
779 802
                // 掲示板メッセージ
780 803
                WriteData.FromCode = CommonDefine.s_MsgBoardSystemCode;	                                    // 書込み者コード
781
                WriteData.FromName = string.Format(CommonDefine.s_MsgBoardSystemNameFormat, "秘書");          // 書込み者名
804
                WriteData.FromName = string.Format(CommonDefine.s_MsgBoardSystemNameFormat, "秘書");        // 書込み者名
782 805

  
783
                WriteData.MessageTitle = CheckRec.SendTitle;                                              // 伝言タイトル
806
                WriteData.MessageTitle = CheckRec.SendTitle;                                                // 伝言タイトル
784 807

  
785 808
                // リンク情報
786 809
                WriteData.LinkType = (int)CommonDefine.LinkType.ConstructionInfo;
......
843 866
                int iCode3 = CommonDefine.ProjectsStatus.First(x => x.Value.Equals("見積提出")).Key;
844 867

  
845 868
                // 対象データが存在するかを確認する
846
                string strSQL = "SELECT A.CONSTRUCTIONCODE, B.DETAILSTRING FROM CONSTRUCTIONBASEINFO A";
847
                strSQL += " LEFT JOIN CONSTRUCTIONBASEINFODETAIL B ON B.CONSTRUCTIONCODE = A.CONSTRUCTIONCODE";
848
                strSQL += string.Format(" AND B.DETAILNO = {0}", (int)ConstructionBaseInfoDetail.DetailDataNo.OrdersDecisionComment);
869
                StringBuilder strSQL = new StringBuilder();
870
                strSQL.Append("SELECT A.CONSTRUCTIONCODE, B.DETAILSTRING");
871
                strSQL.Append(" FROM CONSTRUCTIONBASEINFO A");
872
                strSQL.Append(" LEFT JOIN CONSTRUCTIONBASEINFODETAIL B ON B.CONSTRUCTIONCODE = A.CONSTRUCTIONCODE");
873
                strSQL.AppendFormat(" AND B.DETAILNO = {0}", (int)ConstructionBaseInfoDetail.DetailDataNo.OrdersDecisionComment);
849 874

  
850
                string strWHERE = " WHERE DATE(A.ESTIMATESSUBMITTEDDATE) != STR_TO_DATE('0001/01/01', '%Y/%m/%d')";
851
                strWHERE += string.Format(" AND DATE(DATE_ADD(ESTIMATESSUBMITTEDDATE, INTERVAL '{0}' DAY))", s_NonOrderDay);
852
                strWHERE += string.Format(" < STR_TO_DATE('{0}','%Y/%m/%d')", DateTime.Now.ToShortDateString());
853
                strWHERE += string.Format(" AND A.CONSTRUCTIONSTATUSFLG IN({0}, {1})", iCode2, iCode3);
854
                strWHERE += string.Format(" AND A.ESTIMATETYPE IN ({0}, {1})", (int)CommonDefine.BaseInfoEstimateType.Normal, (int)CommonDefine.BaseInfoEstimateType.GetBudget);
855
                strSQL += strWHERE;
875
                StringBuilder strWHERE = new StringBuilder();
876
                strWHERE.AppendFormat(" WHERE DATE(A.ESTIMATESSUBMITTEDDATE) != STR_TO_DATE('{0}', '%Y/%m/%d')", DateTime.MinValue);
877
                strWHERE.AppendFormat(" AND DATE(DATE_ADD(A.ESTIMATESSUBMITTEDDATE, INTERVAL '{0}' DAY))", s_NonOrderDay);
878
                strWHERE.AppendFormat(" < STR_TO_DATE('{0}','%Y/%m/%d')", DateTime.Now.ToShortDateString());
879
                strWHERE.AppendFormat(" AND A.CONSTRUCTIONSTATUSFLG IN({0}, {1})", iCode2, iCode3);
880
                strWHERE.AppendFormat(" AND A.ESTIMATETYPE IN ({0}, {1})", (int)CommonDefine.BaseInfoEstimateType.Normal, (int)CommonDefine.BaseInfoEstimateType.GetBudget);
881
                strSQL.Append(strWHERE.ToString());
856 882
                ArrayList arList = new ArrayList();
857
                if (!BaseDB.ExecuteReader(strSQL, ref arList))
883
                if (!BaseDB.ExecuteReader(strSQL.ToString(), ref arList))
858 884
                {
859 885
                    logger.ErrorFormat("工事基本情報読込エラー 非受注案件移行処理失敗:{0}:{1}", CommonMotions.GetMethodName(), strSQL);
860 886
                    return false;
......
867 893
                DetailDB.connect(); DetailDB.beginTran();
868 894

  
869 895
                // 工事基本情報データ
870
                strSQL = string.Format("UPDATE CONSTRUCTIONBASEINFO A SET A.CONSTRUCTIONSTATUSFLG = {0},", iCode1);
871
                strSQL += string.Format(" A.NONORDERDATE = STR_TO_DATE('{0}','%Y/%m/%d')", DateTime.Today.ToShortDateString());
872
                strSQL += strWHERE;
873
                if (!BaseDB.ExecuteNonQuery(strSQL, false))
896
                strSQL.Clear();
897
                strSQL.AppendFormat("UPDATE CONSTRUCTIONBASEINFO A SET A.CONSTRUCTIONSTATUSFLG = {0},", iCode1);
898
                strSQL.AppendFormat(" A.NONORDERDATE = STR_TO_DATE('{0}','%Y/%m/%d')", DateTime.Today.ToShortDateString());
899
                strSQL.Append(strWHERE.ToString());
900
                if (!BaseDB.ExecuteNonQuery(strSQL.ToString(), false))
874 901
                {
875 902
                    BaseDB.rollback();
876 903
                    logger.ErrorFormat("工事基本情報更新エラー 非受注案件移行処理失敗:{0}:{1}", CommonMotions.GetMethodName(), strSQL);
......
969 996
                int iCode2 = CommonDefine.ProjectsStatus.First(x => x.Value.Equals("施工完了")).Key;
970 997

  
971 998
                // 入力完了以外を対象にする
972
                string strSQL = string.Format(" A WHERE A.ComplateFlg <> {0}", (int)CommonDefine.ComplateTitleNo.Complated);
973
                strSQL += " AND A.CONSTRUCTIONCODE IN (SELECT A1.CONSTRUCTIONCODE FROM CONSTRUCTIONBASEINFO A1";
974
                strSQL += string.Format(" WHERE A1.CONSTRUCTIONSTATUSFLG != {0}", iCode1);
975
                strSQL += string.Format(" AND A1.CONSTRUCTIONSTATUSFLG < {0})", iCode2);
976
                strSQL += " AND DATE(A.CONSTRUCTIONSTART) <= DATE(NOW())";
977
                strSQL += " ORDER BY A.CONSTRUCTIONSTART ASC";
999
                StringBuilder strSQL = new StringBuilder();
1000
                strSQL.AppendFormat(" A WHERE A.ComplateFlg <> {0}", (int)CommonDefine.ComplateTitleNo.Complated);
1001
                strSQL.Append(" AND A.CONSTRUCTIONCODE IN (SELECT A1.CONSTRUCTIONCODE FROM CONSTRUCTIONBASEINFO A1");
1002
                strSQL.AppendFormat(" WHERE A1.CONSTRUCTIONSTATUSFLG != {0}", iCode1);
1003
                strSQL.AppendFormat(" AND A1.CONSTRUCTIONSTATUSFLG < {0})", iCode2);
1004
                strSQL.Append(" AND DATE(A.CONSTRUCTIONSTART) <= DATE(NOW())");
1005
                strSQL.Append(" ORDER BY A.CONSTRUCTIONSTART ASC");
978 1006
                List<ConstructionLedger> LedgerList = new List<ConstructionLedger>();
979 1007
                // エラーもしくはデータが無い場合は処理しない
980
                if (!LedgerDB.SelectAction(strSQL, ref LedgerList) || LedgerList.Count == 0) return true;
1008
                if (!LedgerDB.SelectAction(strSQL.ToString(), ref LedgerList) || LedgerList.Count == 0) return true;
981 1009

  
982 1010
                // 給与を加算する
983 1011
                ClsChangeLedgerData.CalculatePayment(LedgerList);
......
1007 1035
            try
1008 1036
            {
1009 1037
                // 適用する給与と金額が違うデータを検索する
1010
                string strSQL = "SELECT A.PERSONCODE, A.MONTHLYSALARY, A.YEARSALARY, A.STARTDATE, C.MONTHLYSALARY, C.YEARSALARY";
1011
                strSQL += " FROM PERSONSALARYMASTER A,";
1012
                strSQL += " (SELECT PERSONCODE, MAX(STARTDATE) sDate FROM PERSONSALARYMASTER";
1013
                strSQL += string.Format(" WHERE DATE(STARTDATE) <= STR_TO_DATE('{0}', '%Y/%m/%d') GROUP BY PERSONCODE) B,", DateTime.Today.ToShortDateString());
1014
                strSQL += " PERSONINCHARGEMASTER C";
1015
                strSQL += "  WHERE A.PERSONCODE = B.PERSONCODE AND A.STARTDATE = B.sDate";
1016
                strSQL += " AND C.PERSONCODE = A.PERSONCODE";
1017
                strSQL += " AND (A.MONTHLYSALARY != C.MONTHLYSALARY OR A.YEARSALARY <> C.YEARSALARY)";
1038
                StringBuilder strSQL = new StringBuilder();
1039
                strSQL.Append("SELECT A.PERSONCODE, A.MONTHLYSALARY, A.YEARSALARY, A.STARTDATE, C.MONTHLYSALARY, C.YEARSALARY");
1040
                strSQL.Append(" FROM PERSONSALARYMASTER A,");
1041
                strSQL.Append(" (SELECT B1.PERSONCODE, MAX(B1.STARTDATE) sDate FROM PERSONSALARYMASTER B1");
1042
                strSQL.AppendFormat(" WHERE DATE(B1.STARTDATE) <= STR_TO_DATE('{0}', '%Y/%m/%d') GROUP BY PERSONCODE) B,", DateTime.Today.ToShortDateString());
1043
                strSQL.Append(" PERSONINCHARGEMASTER C");
1044
                strSQL.Append("  WHERE A.PERSONCODE = B.PERSONCODE AND A.STARTDATE = B.sDate");
1045
                strSQL.Append(" AND C.PERSONCODE = A.PERSONCODE");
1046
                strSQL.Append(" AND (A.MONTHLYSALARY != C.MONTHLYSALARY OR A.YEARSALARY <> C.YEARSALARY)");
1018 1047
                ArrayList arList = new ArrayList();
1019
                if (!PersonDB.ExecuteReader(strSQL, ref arList)) return false;
1048
                if (!PersonDB.ExecuteReader(strSQL.ToString(), ref arList)) return false;
1020 1049

  
1021 1050
                // 更新処理
1022 1051
                PersonDB.connect(); PersonDB.beginTran();
branches/src/DataCheckExcute/DataCheckExcute/DataCheckExcute.csproj
193 193
    <Compile Include="..\..\ProcessManagement\ProcessManagement\DataModel\CostomerRegist.cs">
194 194
      <Link>DataModel\CostomerRegist.cs</Link>
195 195
    </Compile>
196
    <Compile Include="..\..\ProcessManagement\ProcessManagement\DataModel\DailyData.cs">
197
      <Link>DataModel\DailyData.cs</Link>
198
    </Compile>
199 196
    <Compile Include="..\..\ProcessManagement\ProcessManagement\DataModel\DailyDataConstruction.cs">
200 197
      <Link>DataModel\DailyDataConstruction.cs</Link>
201 198
    </Compile>
......
487 484
    <Compile Include="..\..\ProcessManagement\ProcessManagement\DB\IOAccess\IOCostomerRegist.cs">
488 485
      <Link>DB\IOAccess\IOCostomerRegist.cs</Link>
489 486
    </Compile>
490
    <Compile Include="..\..\ProcessManagement\ProcessManagement\DB\IOAccess\IODailyData.cs">
491
      <Link>DB\IOAccess\IODailyData.cs</Link>
492
    </Compile>
493 487
    <Compile Include="..\..\ProcessManagement\ProcessManagement\DB\IOAccess\IODailyDataConstruction.cs">
494 488
      <Link>DB\IOAccess\IODailyDataConstruction.cs</Link>
495 489
    </Compile>

他の形式にエクスポート: Unified diff