プロジェクト

全般

プロフィール

リビジョン 390

堀内6年以上前に追加

承認共通クラス:承認時掲示板メッセージ修正
注文書明細:1項目更新メソッド修正
タブ管理クラス:タブ表示メソッド修正
工事承認:積算時同時承認メソッド名称変更
工事情報入力:請求・検査関係日ロック条件修正
工事予算書入力:一般・現場管理費表示追加
工事詳細台帳:増減工事毎に純利益表示追加
注文書入力リスト:グリッド計算処理追加
注文書入力:注文書明細データ登録時セット項目追加
注文書印刷:グリッド計算処理追加
請求書承認状況:新規追加
ログイン:製品版に変更
メニュー:起動時処理順番修正
リビジョン:1へ修正

差分を表示:

trunk/src/ProcessManagement/ProcessManagement/Common/CommonVersion.cs
14 14
        /// <summary>
15 15
        /// 本体バージョン
16 16
        /// </summary>
17
        public static int s_SystemVersion = 235;
17
        public static int s_SystemVersion = 1;
18 18

  
19 19
        /// <summary>
20 20
        /// コピー・環境バージョン
trunk/src/ProcessManagement/ProcessManagement/Common/Process/ClsCommonApproval.cs
1490 1490
                string ConstructionName = CommonMotions.cnvString(MsgObj[(int)MsgObjOrder.ConstructionName]);
1491 1491

  
1492 1492
                // 対象者リストのセット
1493
                List<KeyValuePair<int, string>> ToData = new List<KeyValuePair<int, string>>();
1493
                ArrayList ToData = new ArrayList();
1494 1494
                if (!SetReceiverList(MsgObj, ref ToData)) return false;
1495 1495

  
1496 1496
                MessageBoardData data = new MessageBoardData();
......
1506 1506
                data.FromCode = CommonMotions.LoginUserData.PersonCode;
1507 1507
                data.FromName = CommonMotions.LoginUserData.PersonName;
1508 1508

  
1509
                // 最終承認のチェック
1510
                bool bLastApp = false;
1511
                foreach(object[] CurObj in ToData)
1512
                {
1513
                    int wrkCode = CommonMotions.cnvInt(CurObj[0]);
1514
                    int wrkLast = CommonMotions.cnvInt(CurObj[2]);
1515
                    if(wrkCode== CommonMotions.LoginUserData.PersonCode
1516
                        && wrkLast == (int)ApprovalMaster.ApprovalAuthorityDef.LastApproval)
1517
                    {
1518
                        bLastApp = true;
1519
                        break;
1520
                    }
1521
                }
1522

  
1509 1523
                string ConstrName = ConstructionName;
1510 1524

  
1511 1525
                StringBuilder strMsg = new StringBuilder();
1512
                strMsg.AppendFormat("『{0}』 【{1}】 承認申請", ConstrName, ClsExcute.AppovalList[ApprovalCode]);
1526
                string ApprovalName = ClsExcute.AppovalList[ApprovalCode];
1527

  
1528
                strMsg.AppendFormat("『{0}』 【{1}】", ConstrName, ApprovalName);
1513 1529
                if (ApprovalCode == (int)ClsExcute.ApprovalListNo.PurchaseOrderEntryApproval
1514 1530
                    || ApprovalCode == (int)ClsExcute.ApprovalListNo.OrderRequestApproval)
1515 1531
                {
......
1528 1544
                    //  4:注文書承認 Or 5:請求承認の場合回数追加
1529 1545
                    strMsg.AppendFormat(" 申請受付:{0}回目\r\n", OrderNo);
1530 1546
                }
1531
                strMsg.AppendFormat(" 『{0}』の申請を【{1}】とします。\r\n", ClsExcute.AppovalList[ApprovalCode]
1532
                                                                        , CommonDefine.ApprovalStatusString[StatusFlg]);
1533
                strMsg.Append(" 連絡・指示コメント欄を確認の上対応してください。\r\n");
1534
                strMsg.Append(" よろしくお願いします。");
1547

  
1548
                if (StatusFlg == (int)CommonDefine.ApprovalStatus.Petition)
1549
                {
1550
                    strMsg.AppendFormat(" 『{0}』を申請します。\r\n", ApprovalName);
1551
                    strMsg.Append(" 承認申請関係者、内容を確認の上承認をお願いします。");
1552
                }
1553
                else
1554
                {
1555
                    string strAppStat = CommonDefine.ApprovalStatusString[StatusFlg];
1556
                    strMsg.AppendFormat(" 『{0}』の申請を{1}します。\r\n", ApprovalName, strAppStat.Replace(" ", ""));
1557

  
1558
                    if (StatusFlg == (int)CommonDefine.ApprovalStatus.Approval)
1559
                    {
1560
                        if (bLastApp)
1561
                        {
1562
                            strMsg.Append(" 最終承認が下りました、");
1563
                        }
1564
                        else
1565
                        {
1566
                            strMsg.Append(" 申請途上の承認ですが、");
1567
                        }
1568
                    }
1569

  
1570
                    strMsg.Append("連絡・指示コメント欄を確認・対応の上、行動してください。\r\n");
1571
                    strMsg.Append(" よろしくお願いします。");
1572
                }
1573

  
1535 1574
                data.MessageContent = strMsg.ToString();
1536 1575

  
1537 1576
                // リンク情報
......
1556 1595
                // ----- 対象者書込み
1557 1596
                MessageBoardTerget wrkTer = new MessageBoardTerget();
1558 1597
                int cnt = 1;
1559
                foreach (KeyValuePair<int, string> CurDat in ToData)
1598
                foreach (object[] CurDat in ToData)
1560 1599
                {
1600
                    // ログイン者は対象にしない。
1601
                    if (CommonMotions.cnvInt(CurDat[0]) == CommonMotions.LoginUserData.PersonCode) continue;
1561 1602
                    // キーコードセット
1562 1603
                    wrkTer.RecordNumber = data.RecordNumber;
1563 1604
                    wrkTer.BranchNumber = data.BranchNumber;
1564 1605
                    wrkTer.SeqNum = cnt++;
1565
                    wrkTer.ToCode = CurDat.Key;
1566
                    wrkTer.ToName = CurDat.Value;
1606
                    wrkTer.ToCode = CommonMotions.cnvInt(CurDat[0]);
1607
                    wrkTer.ToName = CommonMotions.cnvString(CurDat[1]);
1567 1608

  
1568 1609
                    // データ登録
1569 1610
                    if (!mbtDB.InsertAction(wrkTer)) return false;
......
1590 1631
        /// <summary>
1591 1632
        /// 対象者リストのセット
1592 1633
        /// </summary>
1593
        private static bool SetReceiverList(object[] MsgObj, ref List<KeyValuePair<int, string>> ToData)
1634
        private static bool SetReceiverList(object[] MsgObj, ref ArrayList ToData)
1594 1635
        {
1595 1636
            IOProcessApproval ApprDB = new IOProcessApproval();
1596 1637
            IOMApproval mAppDB = new IOMApproval();
......
1602 1643
                int CurDepCode = ClsCommonApproval.GetFromConstrAndAppTheDep(ConstructionCode, ApprovalCode, OrderNo);
1603 1644

  
1604 1645
                StringBuilder strSQL = new StringBuilder();
1605
                strSQL.Append("SELECT A.ApprovalPerson, B.PersonName FROM ApprovalMaster As A");
1646
                strSQL.Append("SELECT");
1647
                strSQL.Append(" A.ApprovalPerson");
1648
                strSQL.Append(", B.PersonName");
1649
                strSQL.Append(", A.ApprovalAuthority");
1650
                strSQL.Append(" FROM ApprovalMaster As A");
1606 1651
                strSQL.Append("      Inner Join personinchargemaster As B On B.PersonCode = A.ApprovalPerson");
1607 1652
                strSQL.AppendFormat(" Where A.ApprovalCode = {0}", ApprovalCode);
1608 1653
                strSQL.AppendFormat(" And A.DepartmentCode = {0}", CurDepCode);
......
1614 1659
                {
1615 1660
                    // 承認者は追加しない
1616 1661
                    int ApprovalPerson = CommonMotions.cnvInt(CurObj[0]);
1617
                    if (ApprovalPerson == CommonMotions.LoginUserData.PersonCode) continue;
1662
                    //if (ApprovalPerson == CommonMotions.LoginUserData.PersonCode) continue;
1618 1663

  
1619 1664
                    string ApprovalName = CommonMotions.cnvString(CurObj[1]);
1620
                    ToData.Add(new KeyValuePair<int, string>(ApprovalPerson, ApprovalName));
1665
                    int LastApproval= CommonMotions.cnvInt(CurObj[2]);
1666
                    ToData.Add(new object[] { ApprovalPerson, ApprovalName, LastApproval });
1621 1667
                }
1622 1668

  
1623 1669
                // 申請者を取得する
......
1630 1676
                strSQL.Append("       And A.SeqNo = 1");
1631 1677
                ArrayList arrayL = new ArrayList();
1632 1678
                if (!ApprDB.ExecuteReader(strSQL.ToString(), ref arrayL)) return false;
1633
                if (arrayL.Count < 1) return false;
1679
                // 申請時は申請データが無いので次へ行く
1680
                if (arrayL.Count < 1) return true;
1634 1681

  
1635 1682
                // 申請者がログイン者の場合は処理終了
1636 1683
                object[] CurRec = (object[])arrayL[0];
......
1639 1686

  
1640 1687
                // 申請者が既に登録されていれば取得しない
1641 1688
                bool bIns = true;
1642
                foreach (KeyValuePair<int, string> Tardat in ToData)
1689
                foreach (object[] Tardat in ToData)
1643 1690
                {
1644
                    if (Tardat.Key == PetitionCode)
1691
                    if (CommonMotions.cnvInt(Tardat[0]) == PetitionCode)
1645 1692
                    {
1646 1693
                        bIns = false;
1647 1694
                        break;
......
1652 1699
                if (bIns)
1653 1700
                {
1654 1701
                    string PetitionName = CommonMotions.cnvString(CurRec[1]);
1655
                    ToData.Insert(0, new KeyValuePair<int, string>(PetitionCode, PetitionName));
1702
                    ToData.Insert(0, new object[] { PetitionCode, PetitionName, 0 });
1656 1703
                }
1657 1704

  
1658 1705
                return true;
trunk/src/ProcessManagement/ProcessManagement/DB/IOAccess/IOPurchaseOrderDetail.cs
432 432
                        strcmd.AppendFormat(" OrdersLinePrice = {0}", ((double)value).ToString());
433 433
                        break;
434 434
                    case (int)TableColumn.SourceCode:       // 台帳工事番号
435
                        strcmd.AppendFormat(" SourceCode = {0}", ((int)value).ToString());
435
                        strcmd.AppendFormat(" SourceCode = {0}", value.ToString());
436 436
                        break;
437 437
                    case (int)TableColumn.SourceDetailCnt:	// 台帳明細番号
438
                        strcmd.AppendFormat(" SourceDetailCnt = {0}", ((int)value).ToString());
438
                        strcmd.AppendFormat(" SourceDetailCnt = {0}", value.ToString());
439 439
                        break;
440 440
                    case (int)TableColumn.DataTypeFlag:     // 明細行データタイプフラグ
441 441
                        strcmd.AppendFormat(" DataTypeFlag = {0}", ((int)value).ToString());
trunk/src/ProcessManagement/ProcessManagement/Forms/ControlsAction/TabPageManager.cs
106 106
        /// <summary>
107 107
        /// TabPageの表示・非表示を変更する
108 108
        /// </summary>
109
        /// <param name="menucnt">変更するTabPageのIndex番号</param>
110
        /// <param name="bReq">表示するときはTrue、非表示にするときはFalse。</param>
111
        public void ChangeTabPageVisible(int menucnt, bool bReq)
109
        public void ChangeTabPageVisible()
112 110
        {
113 111
            try
114 112
            {
115
                // 現在の状態が同じならば処理しない
116
                if (m_tabPageInfos[menucnt].Visible == bReq) return;
117

  
118
                // リクエストを保存する
119
                m_tabPageInfos[menucnt].Visible = bReq;
120 113
                // コントロールのレイアウトロジックを一時中断する
121 114
                m_tabControl.SuspendLayout();
122 115
                // 全タブページの消去
trunk/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ApprovalScreen/FrmApprovalScreen.cs
600 600
                if (!DataUpdate(Rec)) return;
601 601

  
602 602
                // ----- ??Z????E??Z?\?Z???????\?????s??
603
                SimultaneousRequestEstimatePetition(ref Rec);
603
                PetitionRequestEstimate(ref Rec);
604 604

  
605 605
                // ----- ???????\???????f?[?^????????
606 606
                if (m_ApprovalCode == (int)ClsExcute.ApprovalListNo.PurchaseOrderEntryApproval)
trunk/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ApprovalScreen/FrmApprovalScreenAuxiliary.cs
1090 1090
        /// 積算見積・積算予算を同時に申請する
1091 1091
        /// </summary>
1092 1092
        /// <param name="Rec"></param>
1093
        private void SimultaneousRequestEstimatePetition(ref ProcessApproval Rec)
1093
        private void PetitionRequestEstimate(ref ProcessApproval Rec)
1094 1094
        {
1095 1095
            try
1096 1096
            {
trunk/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionBaseInfo/FrmConstructionBaseInfo.cs
782 782
                        { false, false, true,  false, false, true,  true,  true,  true,  false, false, false, false, false, false, false,  true,  true},    // 37:?H???S????R?????g
783 783
                        { false, false, false, false, false, false, false, false, true,  true,  false, false, false, false, false, false, false, false},    // 38:?{?H?????R?????g
784 784
                        { true,  true,  false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},    // 39:?c??R?????g
785
                        { false, false, false, false, false, false, false, false, false, true,  true,  false, false, false, false, false, false, false},    // 40:?????R?????g
785
                        { false, false, false, false, false, false, false, false, false, true,  false, false, false, false, false, false, false, false},    // 40:?????R?????g
786 786
                        { false, false, false, false, false, false, false, false, false, true,  true,  false, true,  true,  false, false, false, false},    // 41:?????R?????g
787
                        { false, false, false, false, false, false, false, false, false, true,  true,  false, false, false, false, false, false, false},    // 42:?????????????R?????g
787
                        { false, false, false, false, false, false, false, false, false, true,  false, false, false, false, false, false, false, false},    // 42:?????????????R?????g
788 788

  
789 789
                        //  0      1      2      3      4      5      6      7      8      9     10      11     12     13     14     15     16     17
790 790
                        { false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},    // 43:??I?X?V??
......
798 798
                        { false, false, true,  false, true,  true,  true,  true,  false, false, false, false, false, false, false, false,  true,  true},    // 51:?_??H??????
799 799
                        { true,  true,  false, true,  true,  false, false, false, false, false, false, false, false, false, false, false, false, false},    // 52:?H??????g?b?v??
800 800
                        { false, false, false, false, false, false, false, false, false, true,  false, false, false, false, false, false, false, false},    // 53:?????????J?n??
801
                        { false, false, false, false, false, false, false, false, false, false, true,  false, false, false, false, false, false, false},    // 54:?????m?F??
801
                        { false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},    // 54:?????m?F??
802 802
                        { true,   true,  true,  true,  true, false, false, false, false, false, false, false, false, false, false, false,  true,  true},    // 55:?J?n?\???
803 803
                        { true,  false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},    // 56:?c??S??????
804 804
                        { false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},    // 57:??Z????m?F?\????
......
832 832
                        { false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},    // 83:??????????
833 833
                        { false, false, false, false, false, false, false, false, true,  false, false, false, false, false, false, false, false, false},    // 84:?????\???
834 834
                        { false, false, false, false, false, false, false, false, false, true,  false, false, false, false, false, false, false, false},    // 85:???????s??
835
                        { false, false, false, false, false, false, false, false, false, true,  true,  false, false, false, false, false, false, false},    // 86:??????????????
835
                        { false, false, false, false, false, false, false, false, false, true,  false, false, false, false, false, false, false, false},    // 86:??????????????
836 836
                        { true,  false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},    // 87:?c????S??????
837 837
                        { true,  false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},    // 88:?c????S????R?[?h
838 838

  
trunk/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionBaseInfo/FrmConstructionBaseInfoAuxiliary.cs
6006 6006
            try
6007 6007
            {
6008 6008
                // ????????????????????????????????????????b?N????
6009
                if (m_DspCtrl[(int)DspCnt.RevCompleteDate].Text.Length > 0
6009
                if (m_DspCtrl[(int)DspCnt.RevCompleteDate].Text.Length < 1
6010 6010
                || m_DspCtrl[(int)DspCnt.RevCompleteDate].Text.Equals(CommonDefine.s_UndecidedString))
6011 6011
                {
6012 6012
                    // ??????????????
......
6020 6020
                    btnDataEntry.Visible = true;
6021 6021
                }
6022 6022
                // ?????m?F????????????????????????????b?N????
6023
                if (m_DspCtrl[(int)DspCnt.BillingComplateDate].Text.Length > 0
6023
                if (m_DspCtrl[(int)DspCnt.BillingComplateDate].Text.Length < 1
6024 6024
                || m_DspCtrl[(int)DspCnt.BillingComplateDate].Text.Equals(CommonDefine.s_UndecidedString))
6025 6025
                {
6026 6026
                    // ?????m?F??
trunk/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionBudget/FrmConstructionBudgetAuxiliary.cs
900 900
        }
901 901
        #endregion
902 902

  
903
        #region データ行を指定行に作成
904
        /// <summary>
905
        /// データ行を指定行に作成する
906
        /// </summary>
907
        /// <param name="SetData"></param>
908
        private void InsertDataRow(int RowPoint, object[] SetData, bool ReadOnlyFlg = false)
909
        {
910
            try
911
            {
912
                DataGridViewEX dgv = dgvAllDisplay;
913
                // 行追加
914
                dgv.Rows.Insert(RowPoint, 1);
915

  
916
                // カレント行取得
917
                DataGridViewRow CurRow = dgv.Rows[RowPoint];
918

  
919
                // 行データセット
920
                CurRow.SetValues(SetData);
921
                // フラグセット
922
                CurRow.Cells[(int)GridColumn.TitleFlg].Value = "0";
923
                CurRow.Cells[(int)GridColumn.TotalFlg].Value = "0";
924
                CurRow.Cells[(int)GridColumn.BlankFlg].Value = "0";
925

  
926
                // 表示した行を書込み禁止にする
927
                CurRow.ReadOnly = ReadOnlyFlg;
928

  
929
                // 書込み禁止の場合はセル毎のロック制御はしない
930
                if (ReadOnlyFlg) return;
931

  
932
                // 明細部の編集制御
933
                int GroupNo = CommonMotions.cnvInt(SetData[(int)GridColumn.GroupCount]);
934
                // 行のロック
935
                RowLocking(CurRow, GroupNo);
936

  
937
                // 金額入力の制御
938
                CurRow.Cells[(int)GridColumn.HopePrice].ReadOnly = false;
939
                CurRow.Cells[(int)GridColumn.ExecPrice].ReadOnly = false;
940

  
941
                //bool bReadOnly = false;
942
                //int User = CommonDefine.SecurityRankList[(int)CommonDefine.SecurityRankPos.NormalAuthority].Key;            // 一般ユーザー
943
                //if (CommonMotions.LoginUserSecurity.SecRank == User) bReadOnly = true;
944

  
945
                //// 工事担当者は希望金額のみ入力が可能
946
                //CurRow.Cells[(int)GridColumn.ExecPrice].ReadOnly = bReadOnly;
947

  
948
            }
949
            catch (System.Exception ex)
950
            {
951
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
952
            }
953
        }
954
        #endregion
955

  
903 956
        #region 空行の追加
904 957
        /// <summary>
905 958
        /// 空行を作成する
......
1112 1165
        }
1113 1166
        #endregion
1114 1167

  
1168
        #region 管理費用の表示セット
1169
        /// <summary>
1170
        /// 管理費用の表示セット
1171
        /// </summary>
1172
        private void SetManagementValue()
1173
        {
1174
            try
1175
            {
1176
                int nPlusRow = 0;
1177
                // 一般管理費の表示
1178
                nPlusRow = SetNormalManagement();
1179
                // 挿入行分行カウントをずらす
1180
                for (int i = 0; i < m_CostsRowCount.Count(); i++)
1181
                {
1182
                    m_CostsRowCount[i] += nPlusRow;
1183
                }
1184

  
1185
                // 現場管理費の表示
1186
                nPlusRow = SetFieldManagement();
1187

  
1188
                // 挿入行分行カウントをずらす
1189
                for (int i = (int)CostsRowLine.InstructorRowLine; i <= (int)CostsRowLine.AllTotalRowLine; i++)
1190
                {
1191
                    m_CostsRowCount[i] += nPlusRow;
1192
                }
1193

  
1194
                // 純利益計算
1195
                CreateNetIncome(false);
1196

  
1197
                // 合計金額
1198
                CreateAllTotal(false);
1199

  
1200
            }
1201
            catch (System.Exception ex)
1202
            {
1203
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
1204
            }
1205
        }
1206
        #endregion
1207

  
1208
        #region 管理費の内部コード
1209
        /// <summary>
1210
        /// 管理費の内部コード
1211
        /// </summary>
1212
        private enum ManagementCostCode
1213
        {
1214
            /// <summary>
1215
            /// 一般管理費
1216
            /// </summary>
1217
            Normal = -1,
1218
            /// <summary>
1219
            /// 現場管理費
1220
            /// </summary>
1221
            Field = -2,
1222
        }
1223
        #endregion
1224

  
1225
        #region 一般管理費の表示
1226
        /// <summary>
1227
        /// 一般管理費の表示
1228
        /// </summary>
1229
        private int SetNormalManagement()
1230
        {
1231
            IOEstimateDataDetail eddDB = new IOEstimateDataDetail();
1232
            try
1233
            {
1234
                StringBuilder strSQL = new StringBuilder();
1235
                strSQL.Append("Select");
1236
                strSQL.Append(" A.ConstructionCode");
1237
                strSQL.Append(", A.ComponentCode");
1238
                strSQL.Append(", ifnull(SUM(B.NegotiationPrice), SUM(A.PriceValue))");
1239
                strSQL.Append(" From estimatedata As A");
1240
                strSQL.Append(" Left Join (Select");
1241
                strSQL.Append("                 BB.ConstructionCode");
1242
                strSQL.Append("               , BB.ComponentCode");
1243
                strSQL.Append("               , BB.NegotiationPrice");
1244
                strSQL.Append("           From estimatebudgetdetail As BB");
1245
                strSQL.AppendFormat("     Where BB.ConstructionCode = {0}", m_ConstructionCode);
1246
                strSQL.AppendFormat("     And BB.ComponentCode in ({0}, {1})"
1247
                                                                          , m_CommonCosts.NormalManagementPublic
1248
                                                                          , m_CommonCosts.NormalManagementPrivate);
1249
                strSQL.Append("           And BB.NegotiationPrice <> 0) As B");
1250
                strSQL.Append("       On B.ConstructionCode = A.ConstructionCode");
1251
                strSQL.Append("       And B.ComponentCode = A.ComponentCode");
1252
                strSQL.Append(" Where");
1253
                strSQL.AppendFormat(" A.ConstructionCode = {0}", m_ConstructionCode);
1254
                strSQL.AppendFormat(" And A.ComponentCode in ({0}, {1})"
1255
                                                                          , m_CommonCosts.NormalManagementPublic
1256
                                                                          , m_CommonCosts.NormalManagementPrivate);
1257
                strSQL.Append(" Group By A.ComponentCode");
1258
                ArrayList arrayList = new ArrayList();
1259
                if (!eddDB.ExecuteReader(strSQL.ToString(), ref arrayList)) return 0;
1260
                if (arrayList.Count < 1) return 0;
1261
                object[] objRec = (object[])arrayList[0];
1262
                long wrkdata = CommonMotions.cnvLong(objRec[2]);
1263

  
1264
                object[] RowData = new object[Enum.GetNames(typeof(GridColumn)).Length];
1265
                // データセット
1266
                RowData[(int)GridColumn.GroupCount] = -1;
1267

  
1268
                // パーセント計算
1269
                double OrdersPrice = CommonMotions.cnvDouble(m_DspLabelCtrl[(int)DspLblCtrlName.OrdersPrice].Text.Replace("\\", ""));
1270
                double dExpenses = ((wrkdata / OrdersPrice) * 100.0);
1271

  
1272
                string strVallue = "一 般 管 理 費";
1273
                RowData[(int)GridColumn.FixFlg] = "*";
1274
                RowData[(int)GridColumn.ComponentCode] = (int)ManagementCostCode.Normal;
1275
                RowData[(int)GridColumn.ItemName] = strVallue;
1276
                RowData[(int)GridColumn.EstimatePrice] = wrkdata.ToString("#,#");
1277
                RowData[(int)GridColumn.NegotiationPrice] = wrkdata.ToString("#,#");
1278
                RowData[(int)GridColumn.Percent] = dExpenses.ToString("0.00");
1279

  
1280
                // 行表示
1281
                InsertDataRow(1, RowData, true);
1282

  
1283
                return 1;
1284
            }
1285
            catch (System.Exception ex)
1286
            {
1287
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
1288
                return 0;
1289
            }
1290
            finally
1291
            {
1292
                eddDB.close();eddDB = null;
1293
            }
1294
        }
1295
        #endregion
1296

  
1297
        #region 現場管理費の表示
1298
        /// <summary>
1299
        /// 現場管理費の表示
1300
        /// </summary>
1301
        private int SetFieldManagement()
1302
        {
1303
            IOEstimateDataDetail eddDB = new IOEstimateDataDetail();
1304
            try
1305
            {
1306
                StringBuilder strSQL = new StringBuilder();
1307
                strSQL.Append("Select");
1308
                strSQL.Append(" A.ConstructionCode");
1309
                strSQL.Append(", A.ComponentCode");
1310
                strSQL.Append(", ifnull(SUM(B.NegotiationPrice), SUM(A.PriceValue))");
1311
                strSQL.Append(" From estimatedata As A");
1312
                strSQL.Append(" Left Join (Select");
1313
                strSQL.Append("                 BB.ConstructionCode");
1314
                strSQL.Append("               , BB.ComponentCode");
1315
                strSQL.Append("               , BB.NegotiationPrice");
1316
                strSQL.Append("           From estimatebudgetdetail As BB");
1317
                strSQL.AppendFormat("     Where BB.ConstructionCode = {0}", m_ConstructionCode);
1318
                strSQL.AppendFormat("     And BB.ComponentCode in ({0}, {1})"
1319
                                                                            , m_CommonCosts.FieldManagementPublic
1320
                                                                            , m_CommonCosts.FieldManagementPrivate);
1321
                strSQL.Append("           And BB.NegotiationPrice <> 0) As B");
1322
                strSQL.Append("       On B.ConstructionCode = A.ConstructionCode");
1323
                strSQL.Append("       And B.ComponentCode = A.ComponentCode");
1324
                strSQL.Append(" Where");
1325
                strSQL.AppendFormat(" A.ConstructionCode = {0}", m_ConstructionCode);
1326
                strSQL.AppendFormat(" And A.ComponentCode in ({0}, {1})"
1327
                                                                            , m_CommonCosts.FieldManagementPublic
1328
                                                                            , m_CommonCosts.FieldManagementPrivate);
1329
                strSQL.Append(" Group By A.ComponentCode");
1330
                ArrayList arrayList = new ArrayList();
1331
                if (!eddDB.ExecuteReader(strSQL.ToString(), ref arrayList)) return 0;
1332
                if (arrayList.Count < 1) return 0;
1333
                object[] objRec = (object[])arrayList[0];
1334
                long wrkdata = CommonMotions.cnvLong(objRec[2]);
1335

  
1336
                object[] RowData = new object[Enum.GetNames(typeof(GridColumn)).Length];
1337
                // データセット
1338
                RowData[(int)GridColumn.GroupCount] = -1;
1339

  
1340
                // パーセント計算
1341
                double OrdersPrice = CommonMotions.cnvDouble(m_DspLabelCtrl[(int)DspLblCtrlName.OrdersPrice].Text.Replace("\\", ""));
1342
                double dExpenses = ((wrkdata / OrdersPrice) * 100.0);
1343

  
1344
                string strVallue = "現 場 管 理 費";
1345
                RowData[(int)GridColumn.FixFlg] = "*";
1346
                RowData[(int)GridColumn.ComponentCode] = (int)ManagementCostCode.Field;
1347
                RowData[(int)GridColumn.ItemName] = strVallue;
1348
                RowData[(int)GridColumn.EstimatePrice] = wrkdata.ToString("#,#");
1349
                RowData[(int)GridColumn.NegotiationPrice] = wrkdata.ToString("#,#");
1350
                RowData[(int)GridColumn.Percent] = dExpenses.ToString("0.00");
1351

  
1352
                // 指導員の上に挿入
1353
                int nRowPoint = m_CostsRowCount[(int)CostsRowLine.InstructorRowLine];
1354
                if (nRowPoint < 1) return 0;
1355

  
1356
                // 行表示
1357
                InsertDataRow(nRowPoint, RowData, true);
1358

  
1359
                return 1;
1360
            }
1361
            catch (System.Exception ex)
1362
            {
1363
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
1364
                return 0;
1365
            }
1366
            finally
1367
            {
1368
                eddDB.close(); eddDB = null;
1369
            }
1370
        }
1371
        #endregion
1372

  
1115 1373
        #region 関連工事は会社経費5%だけにする
1116 1374
        /// <summary>
1117 1375
        /// 関連工事は会社経費5%だけにする
......
1195 1453
                dgvAllDisplay.Rows.Clear();
1196 1454

  
1197 1455
                // データがある場合は表示を行う
1198
                if (InitDispData()) return;
1199
                
1200
                // データが無い場合は前プロセスデータから表示
1201
                NotBudgetData();
1456
                if (!InitDispData())
1457
                {
1458
                    // データが無い場合は前プロセスデータから表示
1459
                    NotBudgetData();
1460
                }
1461

  
1462
                // 管理費用の表示セット
1463
                SetManagementValue();
1202 1464
            }
1203 1465
            catch (Exception ex)
1204 1466
            {
......
1327 1589
                    ExecPriceValue += CommonMotions.cnvInt(wrkRow.Cells[(int)GridColumn.ExecPrice].Value);                  // 実行金額
1328 1590
                    PercentValue += CommonMotions.cnvDouble(wrkRow.Cells[(int)GridColumn.Percent].Value);                   // 構成比率
1329 1591
                }
1592

  
1330 1593
                // 総合計フラグがTrueの時は以下を明細に加算する
1331 1594
                if (bAllTotal)
1332 1595
                {
1596
                    // 現場管理費の加算
1597
                    int nInstractorRow = m_CostsRowCount[(int)CostsRowLine.InstructorRowLine];
1598
                    for (int i = nInstractorRow; i > 0; i--)
1599
                    {
1600
                        DataGridViewRow CurRow = dgv.Rows[i];
1601
                        int GroupCode = CommonMotions.cnvInt(CurRow.Cells[(int)GridColumn.GroupCount].Value);
1602
                        int CompCode = CommonMotions.cnvInt(CurRow.Cells[(int)GridColumn.ComponentCode].Value);
1603
                        if (GroupCode == -1 && CompCode == (int)ManagementCostCode.Field)
1604
                        {
1605
                            EstimatePriceValue += CommonMotions.cnvInt(CurRow.Cells[(int)GridColumn.EstimatePrice].Value);
1606
                            NegotiationPriceValue += CommonMotions.cnvInt(CurRow.Cells[(int)GridColumn.NegotiationPrice].Value);
1607
                            break;
1608
                        }
1609
                    }
1333 1610

  
1334 1611
                    // 指導員の給与取得
1335 1612
                    int InstructorHope = 0;
......
1405 1682
                RowData[(int)GridColumn.FixFlg] = "*";
1406 1683
                RowData[(int)GridColumn.GroupCount] = (int)FrmConstructionBudget.DataGroup.AllTotal;
1407 1684
                RowData[(int)GridColumn.ItemName] = s_GroupTitle[(int)FrmConstructionBudget.DataGroup.AllTotal];
1408
                RowData[(int)GridColumn.EstimatePrice] = EstimatePriceValue.ToString("#,0");
1409
                RowData[(int)GridColumn.NegotiationPrice] = NegotiationPriceValue.ToString("#,0");
1410
                RowData[(int)GridColumn.HopePrice] = HopePriceValue.ToString("#,0");
1411
                RowData[(int)GridColumn.ExecPrice] = ExecPriceValue.ToString("#,0");
1412
                RowData[(int)GridColumn.Percent] = CalculattionPercent((double)ExecPriceValue).ToString("0.00");
1413 1685

  
1414 1686
                // 行セット
1415 1687
                CreateDataRow(RowData, true);
......
1434 1706
                    dgv.Rows[LineCnt].Cells[i].Style.BackColor = Color.Black;
1435 1707
                }
1436 1708
            }
1437
            else
1438
            {
1439
                // データセット
1440
                int LineCnt = m_CostsRowCount[(int)CostsRowLine.AllTotalRowLine];
1441
                if (LineCnt == 0) return;
1442
                dgv.Rows[LineCnt].Cells[(int)GridColumn.EstimatePrice].Value = EstimatePriceValue.ToString("#,0");
1443
                dgv.Rows[LineCnt].Cells[(int)GridColumn.NegotiationPrice].Value = NegotiationPriceValue.ToString("#,0");
1444
                dgv.Rows[LineCnt].Cells[(int)GridColumn.HopePrice].Value = HopePriceValue.ToString("#,0");
1445
                dgv.Rows[LineCnt].Cells[(int)GridColumn.ExecPrice].Value = ExecPriceValue.ToString("#,0");
1446
                dgv.Rows[LineCnt].Cells[(int)GridColumn.Percent].Value = CalculattionPercent((double)ExecPriceValue).ToString("0.00");
1447
            }
1709
         
1710
            // データセット
1711
            int RowCnt = m_CostsRowCount[(int)CostsRowLine.AllTotalRowLine];
1712
            if (RowCnt == 0) return;
1713
            dgv.Rows[RowCnt].Cells[(int)GridColumn.EstimatePrice].Value = EstimatePriceValue.ToString("#,0");
1714
            dgv.Rows[RowCnt].Cells[(int)GridColumn.NegotiationPrice].Value = NegotiationPriceValue.ToString("#,0");
1715
            dgv.Rows[RowCnt].Cells[(int)GridColumn.HopePrice].Value = HopePriceValue.ToString("#,0");
1716
            dgv.Rows[RowCnt].Cells[(int)GridColumn.ExecPrice].Value = ExecPriceValue.ToString("#,0");
1717
            dgv.Rows[RowCnt].Cells[(int)GridColumn.Percent].Value = CalculattionPercent((double)ExecPriceValue).ToString("0.00");
1448 1718
        }
1449 1719
        #endregion
1450 1720

  
......
2903 3173
                if (!CheckUserAndLeader()) Content = string.Empty;
2904 3174

  
2905 3175
            GridSet:
3176
                // 空行セット
3177
                AddEmptyRow();
2906 3178

  
2907 3179
                DataGridViewEX dgv = dgvAllDisplay;
2908 3180
                if (CreateRowLine)
......
2931 3203
                    // 行セット
2932 3204
                    CreateDataRow(RowData, true);
2933 3205

  
2934
                    // 行位置取得
2935
                    m_CostsRowCount[(int)CostsRowLine.InstructorRowLine] = dgv.RowCount - 1;
3206
                    // 行位置取得(空行を1行挿入するためここでは最終行をセット)
3207
                    m_CostsRowCount[(int)CostsRowLine.InstructorRowLine] = dgv.RowCount;
2936 3208

  
2937 3209
                    return;     // 新規作成はここで抜ける
2938 3210
                }
......
3059 3331
                // 承認済みは処理しない
3060 3332
                if (ApprovalCheck()) return true;
3061 3333

  
3062
                //// 割合がセットされていなければ処理しない
3334
                // 割合がセットされていなければ処理しない
3063 3335
                //if (DetailRec.AmountConfigRate == 0) return false;
3064 3336

  
3065 3337
                // 名前がセットされていなければ処理しない
......
4016 4288
                {
4017 4289
                    // 合計金額は書き込まない
4018 4290
                    if (CommonMotions.cnvInt(wrkRow.Cells[(int)GridColumn.GroupCount].Value) == (int)FrmConstructionBudget.DataGroup.AllTotal) break;
4019
                    
4291

  
4292
                    // 表示行は処理しない
4293
                    int nGroupCode = CommonMotions.cnvInt(wrkRow.Cells[(int)GridColumn.GroupCount].Value);
4294
                    if (nGroupCode < (int)DataGroup.Expenses) continue;
4295

  
4020 4296
                    // データ定義
4021 4297
                    ConstructionBudgetDetail work = new ConstructionBudgetDetail();
4022 4298

  
......
4038 4314
                    work.ConstructionCode = m_ConstructionCode;
4039 4315

  
4040 4316
                    // グループ番号
4041
                    work.GroupCount = CommonMotions.cnvInt(wrkRow.Cells[(int)GridColumn.GroupCount].Value);
4317
                    work.GroupCount = nGroupCode;
4042 4318

  
4043 4319
                    // 行番号
4044 4320
                    work.LineCount = wrkRow.Index + 1;
......
4160 4436
                    // 空白行は処理しない
4161 4437
                    if (BlankLine(wrkRow.Index)) continue;
4162 4438

  
4439
                    // 表示行は処理しない
4440
                    int nGroupCode = CommonMotions.cnvInt(wrkRow.Cells[(int)GridColumn.GroupCount].Value);
4441
                    if (nGroupCode < (int)DataGroup.Expenses) continue;
4442

  
4163 4443
                    bAns = true;
4164 4444
                    // 実行金額行毎のチェック
4165 4445
                    if (!CommonMotions.chkNumeric(wrkRow.Cells[(int)GridColumn.ExecPrice].Value))
......
4173 4453
                        ErrorRowl = wrkRow.Index;
4174 4454
                        bAns = false;
4175 4455
                    }
4176
                    
4456

  
4177 4457
                    // 共通仮設費・外注費・自社施工のみ積算金額がある
4178
                    if (CommonMotions.cnvInt(wrkRow.Cells[(int)GridColumn.GroupCount].Value) == (int)FrmConstructionBudget.DataGroup.CommonTempCosts ||
4179
                        CommonMotions.cnvInt(wrkRow.Cells[(int)GridColumn.GroupCount].Value) == (int)FrmConstructionBudget.DataGroup.OutSourceCosts ||
4180
                        CommonMotions.cnvInt(wrkRow.Cells[(int)GridColumn.GroupCount].Value) == (int)FrmConstructionBudget.DataGroup.MyConstruction)
4458
                    if (nGroupCode == (int)FrmConstructionBudget.DataGroup.CommonTempCosts ||
4459
                        nGroupCode == (int)FrmConstructionBudget.DataGroup.OutSourceCosts ||
4460
                        nGroupCode == (int)FrmConstructionBudget.DataGroup.MyConstruction)
4181 4461
                    {
4182 4462
                        // 交渉金額行毎のチェック
4183 4463
                        if (!CommonMotions.chkNumeric(wrkRow.Cells[(int)GridColumn.NegotiationPrice].Value))
trunk/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedger/FrmConstructionLedger.cs
661 661
        /// </summary>
662 662
        private ClsCommonCosts m_CommonCosts = new ClsCommonCosts();
663 663

  
664
        /// <summary>
665
        /// ??????H????????X?g
666
        /// </summary>
667
        private List<int> m_SourceCodeList = new List<int>();
668

  
664 669
        #region // *-----* ????????????A?g *-----*????
665 670

  
666 671
        /// <summary>
......
1154 1159
            }
1155 1160

  
1156 1161
            // ???b?N???Delete?EBack?L?[?????
1157
            if (e.KeyCode == Keys.Delete || e.KeyCode == Keys.Back)
1158
            {
1159
                DataGridViewCell CurCell = dgvAllDisplay.CurrentCell;
1160
                // ?????????????????
1161
                if (CurCell.ColumnIndex != (int)GridColumn.CompanyName) return;
1162
            if (e.KeyCode != Keys.Delete && e.KeyCode != Keys.Back) return;
1162 1163

  
1163
                DataGridViewRow CurRow = dgvAllDisplay.CurrentRow;
1164
                // ????????E?O?????????????
1165
                int GroupNo = CommonMotions.cnvInt(CurRow.Cells[(int)GridColumn.GroupCount].Value);
1166
                if (GroupNo != (int)FrmConstructionBudget.DataGroup.CommonTempCosts
1167
                    && GroupNo != (int)FrmConstructionBudget.DataGroup.OutSourceCosts) return;
1168 1164

  
1169
                // ??????R?[?h?E??????N???A????
1170
                CurRow.Cells[(int)(int)GridColumn.CompanyType].Value = 0;
1171
                CurRow.Cells[(int)(int)GridColumn.CompanyCode].Value = 0;
1172
                CurRow.Cells[(int)(int)GridColumn.CompanyName].Value = string.Empty;
1173
                m_bChengeAns = true;
1174
            }
1165
            DataGridViewCell CurCell = dgvAllDisplay.CurrentCell;
1166
            DataGridViewRow CurRow = dgvAllDisplay.CurrentRow;
1167

  
1168
            int GroupNo = CommonMotions.cnvInt(CurRow.Cells[(int)GridColumn.GroupCount].Value);
1169
            // ?{?H???????????
1170
            if (GroupNo != (int)FrmConstructionLedger.DataGroup.ConstructionCosts) return;
1171

  
1172
            // ?????????????????
1173
            if (CurCell.ColumnIndex != (int)GridColumn.CompanyName) return;
1174

  
1175
            // ??????R?[?h?E??????N???A????
1176
            CurRow.Cells[(int)(int)GridColumn.CompanyType].Value = 0;
1177
            CurRow.Cells[(int)(int)GridColumn.CompanyCode].Value = 0;
1178
            CurRow.Cells[(int)(int)GridColumn.CompanyName].Value = string.Empty;
1179

  
1180
            m_bChengeAns = true;
1175 1181
        }
1176 1182
        #endregion
1177 1183

  
......
1606 1612
        private void button1_Click(object sender, EventArgs e)
1607 1613
        {
1608 1614
            // ?t???O?R???o?[?g
1609
            Convert1();
1615
            //Convert1();
1616
            PurchaseLineUpdate();
1610 1617
        }
1611 1618
        /// <summary>
1612 1619
        /// ?S???E???S???E?w?????????t??
trunk/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedger/FrmConstructionLedger.designer.cs
87 87
            this.btnLineDel = new System.Windows.Forms.Button();
88 88
            this.btnLineAdd = new System.Windows.Forms.Button();
89 89
            this.panel2 = new System.Windows.Forms.Panel();
90
            this.lblCellTotal = new System.Windows.Forms.Label();
91
            this.btnDispDown = new System.Windows.Forms.Button();
92
            this.btnDispUp = new System.Windows.Forms.Button();
93
            this.btnOtherProc = new System.Windows.Forms.Button();
94
            this.button1 = new System.Windows.Forms.Button();
95
            this.button2 = new System.Windows.Forms.Button();
96
            this.btnSelect = new System.Windows.Forms.Button();
97
            this.btnCreate = new System.Windows.Forms.Button();
90 98
            this.dgvAllDisplay = new ProcessManagement.Forms.CustomControls.DataGridViewEX();
91 99
            this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
92 100
            this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
......
117 125
            this.Column25 = new System.Windows.Forms.DataGridViewTextBoxColumn();
118 126
            this.Column26 = new System.Windows.Forms.DataGridViewTextBoxColumn();
119 127
            this.Column28 = new System.Windows.Forms.DataGridViewTextBoxColumn();
120
            this.lblCellTotal = new System.Windows.Forms.Label();
121
            this.btnDispDown = new System.Windows.Forms.Button();
122
            this.btnDispUp = new System.Windows.Forms.Button();
123
            this.btnOtherProc = new System.Windows.Forms.Button();
124
            this.button1 = new System.Windows.Forms.Button();
125
            this.button2 = new System.Windows.Forms.Button();
126
            this.btnSelect = new System.Windows.Forms.Button();
127
            this.btnCreate = new System.Windows.Forms.Button();
128 128
            this.grpExample1 = new ProcessManagement.Forms.CustomControls.GroupBoxEx();
129 129
            this.lblReqSumType03 = new System.Windows.Forms.Label();
130 130
            this.lblReqSumType01 = new System.Windows.Forms.Label();
......
794 794
            this.panel2.Size = new System.Drawing.Size(1290, 450);
795 795
            this.panel2.TabIndex = 36;
796 796
            // 
797
            // lblCellTotal
798
            // 
799
            this.lblCellTotal.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
800
            this.lblCellTotal.AutoSize = true;
801
            this.lblCellTotal.BackColor = System.Drawing.Color.WhiteSmoke;
802
            this.lblCellTotal.Font = new System.Drawing.Font("MS P明朝", 9.75F, System.Drawing.FontStyle.Bold);
803
            this.lblCellTotal.ForeColor = System.Drawing.Color.Black;
804
            this.lblCellTotal.Location = new System.Drawing.Point(100, 430);
805
            this.lblCellTotal.Name = "lblCellTotal";
806
            this.lblCellTotal.Size = new System.Drawing.Size(0, 13);
807
            this.lblCellTotal.TabIndex = 36;
808
            // 
809
            // btnDispDown
810
            // 
811
            this.btnDispDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
812
            this.btnDispDown.Font = new System.Drawing.Font("MS 明朝", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
813
            this.btnDispDown.Location = new System.Drawing.Point(1300, 418);
814
            this.btnDispDown.Name = "btnDispDown";
815
            this.btnDispDown.Size = new System.Drawing.Size(40, 40);
816
            this.btnDispDown.TabIndex = 42;
817
            this.btnDispDown.TabStop = false;
818
            this.btnDispDown.Text = "▼";
819
            this.btnDispDown.UseVisualStyleBackColor = true;
820
            this.btnDispDown.Visible = false;
821
            this.btnDispDown.Click += new System.EventHandler(this.btnDispDown_Click);
822
            // 
823
            // btnDispUp
824
            // 
825
            this.btnDispUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
826
            this.btnDispUp.Font = new System.Drawing.Font("MS 明朝", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
827
            this.btnDispUp.Location = new System.Drawing.Point(1300, 354);
828
            this.btnDispUp.Name = "btnDispUp";
829
            this.btnDispUp.Size = new System.Drawing.Size(40, 40);
830
            this.btnDispUp.TabIndex = 41;
831
            this.btnDispUp.TabStop = false;
832
            this.btnDispUp.Text = "▲";
833
            this.btnDispUp.UseVisualStyleBackColor = true;
834
            this.btnDispUp.Visible = false;
835
            this.btnDispUp.Click += new System.EventHandler(this.btnDispUp_Click);
836
            // 
837
            // btnOtherProc
838
            // 
839
            this.btnOtherProc.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
840
            this.btnOtherProc.BackColor = System.Drawing.Color.SpringGreen;
841
            this.btnOtherProc.Location = new System.Drawing.Point(7, 656);
842
            this.btnOtherProc.Name = "btnOtherProc";
843
            this.btnOtherProc.Size = new System.Drawing.Size(160, 30);
844
            this.btnOtherProc.TabIndex = 95;
845
            this.btnOtherProc.TabStop = false;
846
            this.btnOtherProc.Text = "他の画面へ";
847
            this.btnOtherProc.UseVisualStyleBackColor = false;
848
            this.btnOtherProc.Click += new System.EventHandler(this.btnOtherProc_Click);
849
            // 
850
            // button1
851
            // 
852
            this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
853
            this.button1.Location = new System.Drawing.Point(1300, 540);
854
            this.button1.Name = "button1";
855
            this.button1.Size = new System.Drawing.Size(37, 35);
856
            this.button1.TabIndex = 100;
857
            this.button1.Text = "○";
858
            this.button1.UseVisualStyleBackColor = true;
859
            this.button1.Visible = false;
860
            this.button1.Click += new System.EventHandler(this.button1_Click);
861
            // 
862
            // button2
863
            // 
864
            this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
865
            this.button2.Location = new System.Drawing.Point(1300, 581);
866
            this.button2.Name = "button2";
867
            this.button2.Size = new System.Drawing.Size(37, 35);
868
            this.button2.TabIndex = 101;
869
            this.button2.Text = "1";
870
            this.button2.UseVisualStyleBackColor = true;
871
            this.button2.Visible = false;
872
            this.button2.Click += new System.EventHandler(this.button2_Click);
873
            // 
874
            // btnSelect
875
            // 
876
            this.btnSelect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
877
            this.btnSelect.BackColor = System.Drawing.Color.Green;
878
            this.btnSelect.Font = new System.Drawing.Font("MS 明朝", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
879
            this.btnSelect.ForeColor = System.Drawing.Color.White;
880
            this.btnSelect.Location = new System.Drawing.Point(546, 657);
881
            this.btnSelect.Name = "btnSelect";
882
            this.btnSelect.Size = new System.Drawing.Size(120, 30);
883
            this.btnSelect.TabIndex = 102;
884
            this.btnSelect.Text = "選 択";
885
            this.btnSelect.UseVisualStyleBackColor = false;
886
            this.btnSelect.Visible = false;
887
            this.btnSelect.Click += new System.EventHandler(this.btnSelect_Click);
888
            // 
889
            // btnCreate
890
            // 
891
            this.btnCreate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
892
            this.btnCreate.BackColor = System.Drawing.Color.White;
893
            this.btnCreate.Font = new System.Drawing.Font("MS 明朝", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
894
            this.btnCreate.ForeColor = System.Drawing.Color.Green;
895
            this.btnCreate.Location = new System.Drawing.Point(420, 657);
896
            this.btnCreate.Name = "btnCreate";
897
            this.btnCreate.Size = new System.Drawing.Size(120, 30);
898
            this.btnCreate.TabIndex = 103;
899
            this.btnCreate.Text = "新 規";
900
            this.btnCreate.UseVisualStyleBackColor = false;
901
            this.btnCreate.Visible = false;
902
            this.btnCreate.Click += new System.EventHandler(this.btnCreate_Click);
903
            // 
797 904
            // dgvAllDisplay
798 905
            // 
799 906
            this.dgvAllDisplay.AllowUserToAddRows = false;
......
1136 1243
            this.Column28.ReadOnly = true;
1137 1244
            this.Column28.Visible = false;
1138 1245
            // 
1139
            // lblCellTotal
1140
            // 
1141
            this.lblCellTotal.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
1142
            this.lblCellTotal.AutoSize = true;
1143
            this.lblCellTotal.BackColor = System.Drawing.Color.WhiteSmoke;
1144
            this.lblCellTotal.Font = new System.Drawing.Font("MS P明朝", 9.75F, System.Drawing.FontStyle.Bold);
1145
            this.lblCellTotal.ForeColor = System.Drawing.Color.Black;
1146
            this.lblCellTotal.Location = new System.Drawing.Point(100, 430);
1147
            this.lblCellTotal.Name = "lblCellTotal";
1148
            this.lblCellTotal.Size = new System.Drawing.Size(0, 13);
1149
            this.lblCellTotal.TabIndex = 36;
1150
            // 
1151
            // btnDispDown
1152
            // 
1153
            this.btnDispDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
1154
            this.btnDispDown.Font = new System.Drawing.Font("MS 明朝", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
1155
            this.btnDispDown.Location = new System.Drawing.Point(1300, 418);
1156
            this.btnDispDown.Name = "btnDispDown";
1157
            this.btnDispDown.Size = new System.Drawing.Size(40, 40);
1158
            this.btnDispDown.TabIndex = 42;
1159
            this.btnDispDown.TabStop = false;
1160
            this.btnDispDown.Text = "▼";
1161
            this.btnDispDown.UseVisualStyleBackColor = true;
1162
            this.btnDispDown.Visible = false;
1163
            this.btnDispDown.Click += new System.EventHandler(this.btnDispDown_Click);
1164
            // 
1165
            // btnDispUp
1166
            // 
1167
            this.btnDispUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
1168
            this.btnDispUp.Font = new System.Drawing.Font("MS 明朝", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
1169
            this.btnDispUp.Location = new System.Drawing.Point(1300, 354);
1170
            this.btnDispUp.Name = "btnDispUp";
1171
            this.btnDispUp.Size = new System.Drawing.Size(40, 40);
1172
            this.btnDispUp.TabIndex = 41;
1173
            this.btnDispUp.TabStop = false;
1174
            this.btnDispUp.Text = "▲";
1175
            this.btnDispUp.UseVisualStyleBackColor = true;
1176
            this.btnDispUp.Visible = false;
1177
            this.btnDispUp.Click += new System.EventHandler(this.btnDispUp_Click);
1178
            // 
1179
            // btnOtherProc
1180
            // 
1181
            this.btnOtherProc.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
1182
            this.btnOtherProc.BackColor = System.Drawing.Color.SpringGreen;
1183
            this.btnOtherProc.Location = new System.Drawing.Point(7, 656);
1184
            this.btnOtherProc.Name = "btnOtherProc";
1185
            this.btnOtherProc.Size = new System.Drawing.Size(160, 30);
1186
            this.btnOtherProc.TabIndex = 95;
1187
            this.btnOtherProc.TabStop = false;
1188
            this.btnOtherProc.Text = "他の画面へ";
1189
            this.btnOtherProc.UseVisualStyleBackColor = false;
1190
            this.btnOtherProc.Click += new System.EventHandler(this.btnOtherProc_Click);
1191
            // 
1192
            // button1
1193
            // 
1194
            this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
1195
            this.button1.Location = new System.Drawing.Point(1300, 540);
1196
            this.button1.Name = "button1";
1197
            this.button1.Size = new System.Drawing.Size(37, 35);
1198
            this.button1.TabIndex = 100;
1199
            this.button1.Text = "○";
1200
            this.button1.UseVisualStyleBackColor = true;
1201
            this.button1.Visible = false;
1202
            this.button1.Click += new System.EventHandler(this.button1_Click);
1203
            // 
1204
            // button2
1205
            // 
1206
            this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
1207
            this.button2.Location = new System.Drawing.Point(1300, 581);
1208
            this.button2.Name = "button2";
1209
            this.button2.Size = new System.Drawing.Size(37, 35);
1210
            this.button2.TabIndex = 101;
1211
            this.button2.Text = "1";
1212
            this.button2.UseVisualStyleBackColor = true;
1213
            this.button2.Visible = false;
1214
            this.button2.Click += new System.EventHandler(this.button2_Click);
1215
            // 
1216
            // btnSelect
1217
            // 
1218
            this.btnSelect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
1219
            this.btnSelect.BackColor = System.Drawing.Color.Green;
1220
            this.btnSelect.Font = new System.Drawing.Font("MS 明朝", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
1221
            this.btnSelect.ForeColor = System.Drawing.Color.White;
1222
            this.btnSelect.Location = new System.Drawing.Point(546, 657);
1223
            this.btnSelect.Name = "btnSelect";
1224
            this.btnSelect.Size = new System.Drawing.Size(120, 30);
1225
            this.btnSelect.TabIndex = 102;
1226
            this.btnSelect.Text = "選 択";
1227
            this.btnSelect.UseVisualStyleBackColor = false;
1228
            this.btnSelect.Visible = false;
1229
            this.btnSelect.Click += new System.EventHandler(this.btnSelect_Click);
1230
            // 
1231
            // btnCreate
1232
            // 
1233
            this.btnCreate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
1234
            this.btnCreate.BackColor = System.Drawing.Color.White;
1235
            this.btnCreate.Font = new System.Drawing.Font("MS 明朝", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
1236
            this.btnCreate.ForeColor = System.Drawing.Color.Green;
1237
            this.btnCreate.Location = new System.Drawing.Point(420, 657);
1238
            this.btnCreate.Name = "btnCreate";
1239
            this.btnCreate.Size = new System.Drawing.Size(120, 30);
1240
            this.btnCreate.TabIndex = 103;
1241
            this.btnCreate.Text = "新 規";
1242
            this.btnCreate.UseVisualStyleBackColor = false;
1243
            this.btnCreate.Visible = false;
1244
            this.btnCreate.Click += new System.EventHandler(this.btnCreate_Click);
1245
            // 
1246 1246
            // grpExample1
1247 1247
            // 
1248 1248
            this.grpExample1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
trunk/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedger/FrmConstructionLedgerAuxiliary.cs
1239 1239
                    dgv.Rows[m_BeforeGridRow].Cells[i].Style.ForeColor = s_RowForeSelectColor;
1240 1240
                }
1241 1241
                // 増減データは色を付ける
1242
                if (CommonMotions.cnvInt(dgv.Rows[m_BeforeGridRow].Cells[(int)GridColumn.FluctuationFlg].Value) != 0)
1243
                {
1244
                    dgv.Rows[m_BeforeGridRow].Cells[(int)GridColumn.No].Style.BackColor = Color.Red;
1245
                }
1242
                //if (CommonMotions.cnvInt(dgv.Rows[m_BeforeGridRow].Cells[(int)GridColumn.FluctuationFlg].Value) != 0)
1243
                //{
1244
                //    dgv.Rows[m_BeforeGridRow].Cells[(int)GridColumn.No].Style.BackColor = Color.Red;
1245
                //}
1246 1246
            }
1247 1247
            catch (System.Exception ex)
1248 1248
            {
......
1410 1410
                            SetBackColor = Color.White;
1411 1411
                            // 増減工事フラグがONの場合は色を変える
1412 1412
                            if (CommonMotions.cnvInt(CurRow.Cells[(int)GridColumn.FluctuationFlg].Value) != 0)
1413
                                SetBackColor = Color.Red;
1413
                            {
1414
                                //SetBackColor = Color.Red;
1415
                                int nIndex = m_SourceCodeList.IndexOf(CommonMotions.cnvInt(CurRow.Cells[(int)GridColumn.SourceCode].Value));
1416
                                SetBackColor = CommonDefine.DefineColorList[nIndex];
1417
                            }
1414 1418
                            break;
1415 1419
                        default:
1416 1420
                            SetBackColor = Color.White;
......
1494 1498
                // 請求金額計算
1495 1499
                CalculateBillingAmount();
1496 1500
                // 純利益計算
1497
                CalculateNetIncome();
1501
                //CalculateNetIncome();
1498 1502
                // 合計計算
1499 1503
                CreateAllTotal(false);
1500 1504
                /// 現在利益計算
......
1587 1591
        /// <summary>
1588 1592
        /// 工事予算書明細データより明細のデータを取り込む
1589 1593
        /// </summary>
1590
        /// <param name="DetailList"></param>
1591 1594
        private void GetDataFromBudgetDetail(ref List<ConstructionBudgetDetail> DetailList)
1592 1595
        {
1593 1596
            IOConstructionBudgetDetail DetailDB = new IOConstructionBudgetDetail();
......
1935 1938

  
1936 1939
                int nSetRow = m_CostsRowCount[(int)CostsRowLine.ExpensesRowLine] - 1;
1937 1940
                dgvAllDisplay.Rows[nSetRow].Cells[(int)GridColumn.EstimatePrice].Value = nRetVal.ToString("#,#");
1941
                dgvAllDisplay.Rows[nSetRow].Cells[(int)GridColumn.EstimatePrice].ToolTipText = "一 般 管 理 費";
1938 1942
            }
1939 1943
            catch (Exception ex)
1940 1944
            {
......
1993 1997
                // 現場管理費を人件費タイトルへセットする
1994 1998
                int nSetRow = m_CostsRowCount[(int)CostsRowLine.InstructorRowLine] - 1;
1995 1999
                dgvAllDisplay.Rows[nSetRow].Cells[(int)GridColumn.EstimatePrice].Value = nRetVal.ToString("#,#");
2000
                dgvAllDisplay.Rows[nSetRow].Cells[(int)GridColumn.EstimatePrice].ToolTipText = "現 場 管 理 費";
1996 2001
            }
1997 2002
            catch (Exception ex)
1998 2003
            {
......
2517 2522
        }
2518 2523
        #endregion
2519 2524

  
2520
        #region 純利益計算
2525
        #region 純利益計算(未使用)
2521 2526
        /// <summary>
2522
        /// 純利益計算
2527
        /// 純利益計算(未使用)
2523 2528
        /// </summary>
2524 2529
        /// <returns></returns>
2525 2530
        private void CalculateNetIncome()
......
2602 2607
        }
2603 2608
        #endregion
2604 2609

  
2605
        #region 純利益作成
2610
        #region 純利益作成(新規作成時)
2606 2611
        /// <summary>
2607
        /// 純利益作成
2612
        /// 純利益作成(新規作成時)
2608 2613
        /// </summary>
2609 2614
        /// <returns></returns>
2610 2615
        private void CreateNetIncome()
......
2660 2665
        }
2661 2666
        #endregion
2662 2667

  
2668
        #region 表示明細行より対象行数を返す
2669
        /// <summary>
2670
        /// 表示明細行より対象行数を返す
2671
        /// </summary>
2672
        private int RowCountPoint(int nCode, ArrayList DetailList)
2673
        {
2674
            try
2675
            {
2676
                int nPo = 0;
2677
                int i = 0;
2678
                foreach(object[] CurObj in DetailList)
2679
                {
2680
                    // 同じコードの行数を取得する
2681
                    int nCurCode = CommonMotions.cnvInt(CurObj[(int)IOConstructionLedgerDetail.TableColumn.SourceCode]);
2682
                    if (nCurCode == nCode)
2683
                    {
2684
                        nPo = i;
2685
                        break;
2686
                    }
2687
                    i++;
2688
                }
2689

  
2690
                return nPo;
2691
            }
2692
            catch (Exception ex)
2693
            {
2694
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
2695
                return 0;
2696
            }
2697
        }
2698
        #endregion
2699

  
2700
        #region 指定コードの発注金額(注文書が無ければ実行金額)を返す
2701
        /// <summary>
2702
        /// 指定コードの発注金額(注文書が無ければ実行金額)を返す
2703
        /// </summary>
2704
        private long GetPurchaseValue(int nCode)
2705
        {
2706
            IOConstructionLedgerDetail cldDB = new IOConstructionLedgerDetail();
2707
            try
2708
            {
2709
                StringBuilder strSQL = new StringBuilder();
2710
                strSQL.Append("Select");
2711

  
2712
                strSQL.Append(" SUM(CASE WHEN ifnull(Odr.OrdersLinePrice, 0) > 0 THEN ifnull(Odr.OrdersLinePrice, 0)");
2713
                strSQL.Append(" ELSE A.ExecutionAmount END) As OrderPrice");
2714

  
2715
                strSQL.Append(" From constructionledgerdetail As A");
2716

  
2717
                strSQL.Append("      LEFT JOIN(Select OdrA.ConstructionCode, OdrA.SourceDetailCnt, SUM(OdrA.OrdersLinePrice) As OrdersLinePrice");
2718
                strSQL.Append("                From PurchaseOrderDetail As OdrA");
2719
                strSQL.AppendFormat("          Where OdrA.ConstructionCode = {0}", nCode);
2720
                strSQL.AppendFormat("          And OdrA.SourceCode = {0}", m_ConstructionCode);
2721
                strSQL.AppendFormat("          And OdrA.GroupCount in ({0}, {1})", (int)PurchaseOrderDetail.GroupCountDef.Detail
2722
                                                                                    , (int)PurchaseOrderDetail.GroupCountDef.StatutoryWelfare);
2723
                strSQL.AppendFormat("          Group By OdrA.SourceDetailCnt) As Odr");
2724
                strSQL.AppendFormat("    ON Odr.ConstructionCode = A.SourceCode");
2725
                strSQL.AppendFormat("    And Odr.SourceDetailCnt = A.DetailCount");
2726
            
2727
                //strSQL.Append(" LEFT JOIN PurchaseOrderDetail As Odr");
2728
                //strSQL.Append("       ON Odr.ConstructionCode = A.SourceCode");
2729
                //strSQL.Append("       And Odr.SourceCode = A.ConstructionCode");
2730
                //strSQL.Append("       And Odr.SourceDetailCnt = A.DetailCount");
2731

  
2732
                strSQL.AppendFormat(" Where A.ConstructionCode = {0}", m_ConstructionCode);
2733
                strSQL.AppendFormat(" And A.SourceCode = {0}", nCode);
2734
                strSQL.AppendFormat(" And ({0} < A.GroupCount", (int)DataGroup.Expenses);
2735
                strSQL.AppendFormat(" And A.GroupCount < {0})", (int)DataGroup.Instructor);
2736

  
2737
                ArrayList arrayList = new ArrayList();
2738
                if (!cldDB.ExecuteReader(strSQL.ToString(), ref arrayList)) return 0;
2739
                if (arrayList.Count < 1) return 0;
2740

  
2741
                object[] objRec = (object[])arrayList[0];
2742

  
2743
                return CommonMotions.cnvLong(objRec[0]);
2744
            }
2745
            catch (Exception ex)
2746
            {
2747
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
2748
                return 0;
2749
            }
2750
            finally
2751
            {
2752
                cldDB.close(); cldDB = null;
2753
            }
2754
        }
2755
        #endregion
2756

  
2757
        #region 純利益作成(データ存在時)
2758
        /// <summary>
2759
        /// 純利益作成(データ存在時)
2760
        /// </summary>
2761
        /// <returns></returns>
2762
        private void CreateNetIncome2(ArrayList DetailList)
2763
        {
2764
            try
2765
            {
2766
                DataGridViewEX dgv = dgvAllDisplay;
2767

  
2768
                int DetailCnt = Enum.GetNames(typeof(IOConstructionLedgerDetail.TableColumn)).Length;
2769
                int SaveLineCnt = -1;
2770
                int nRowCnt = 0;
2771
                long[] DispVal = new long[3];
2772
                List<long> OrderVal = new List<long>();
2773
                List<long> EstVal = new List<long>();
2774
                List<long> ExecVal = new List<long>();
2775
                List<long> PurVal = new List<long>();
2776
                foreach (int CurCode in m_SourceCodeList)
2777
                {
2778
                    int nCnt = RowCountPoint(CurCode, DetailList);
2779
                    object[] DetialObj = (object[])DetailList[nCnt];
2780
                    // 受注金額
2781
                    OrderVal.Add(CommonMotions.cnvLong(DetialObj[DetailCnt + (int)DetailReadOrder.OrdersPrice]));
2782
                    // 予算金額
2783
                    long wrkEstVal = CommonMotions.cnvLong(DetialObj[DetailCnt + (int)DetailReadOrder.Budget1_SumOdrVal])
2784
                                + CommonMotions.cnvLong(DetialObj[DetailCnt + (int)DetailReadOrder.Budget2_SumOdrVal])
2785
                                + CommonMotions.cnvLong(DetialObj[DetailCnt + (int)DetailReadOrder.Budget3_SumOdrVal])
2786
                                + CommonMotions.cnvLong(DetialObj[DetailCnt + (int)DetailReadOrder.Budget4_SumOdrVal]);
2787
                    EstVal.Add(wrkEstVal);
2788
                    // 実行金額
2789
                    long wrkExecVal = CommonMotions.cnvLong(DetialObj[DetailCnt + (int)DetailReadOrder.Budget1_SumExecVal])
2790
                                + CommonMotions.cnvLong(DetialObj[DetailCnt + (int)DetailReadOrder.Budget2_SumExecVal])
2791
                                + CommonMotions.cnvLong(DetialObj[DetailCnt + (int)DetailReadOrder.Budget3_SumExecVal])
2792
                                + CommonMotions.cnvLong(DetialObj[DetailCnt + (int)DetailReadOrder.Budget4_SumExecVal]);
2793
                    ExecVal.Add(wrkExecVal);
2794
                    // 発注金額
2795
                    long wrkExpenses = CommonMotions.cnvLong(DetialObj[DetailCnt + (int)DetailReadOrder.Budget1_SumExecVal]);
2796
                    long wrkPayVal = CommonMotions.cnvLong(DetialObj[DetailCnt + (int)DetailReadOrder.Budget4_SumExecVal]);
2797
                    PurVal.Add((GetPurchaseValue(CurCode) + wrkExpenses + wrkPayVal));
2798

  
2799
                    // 予算書金額
2800
                    DispVal[0] = OrderVal.Sum() - EstVal.Sum();
2801
                    // 実行金額
2802
                    DispVal[1] = OrderVal.Sum() - ExecVal.Sum();
2803
                    // 発注金額
2804
                    DispVal[2] = OrderVal.Sum() - PurVal.Sum();
2805

  
2806
                    // データセット
2807
                    object[] RowData = new object[dgv.Columns.Count];
2808
                    RowData[(int)GridColumn.FixFlg] = "*";
2809
                    RowData[(int)GridColumn.GroupCount] = (int)DataGroup.NetIncome;
2810
                    if (nRowCnt < 1) RowData[(int)GridColumn.ItemName] = s_GroupTitle[(int)DataGroup.NetIncome];
2811
                    RowData[(int)GridColumn.EstimatePrice] = DispVal[0].ToString("#,0");
2812
                    RowData[(int)GridColumn.ExecPrice] = DispVal[1].ToString("#,0");
2813
                    RowData[(int)GridColumn.Percent] = CalculattionPercent((double)DispVal[1]).ToString("0.00");
2814
                    RowData[(int)GridColumn.OrderPrice] = DispVal[2].ToString("#,0");
2815
                    RowData[(int)GridColumn.IndependentFlg] = "1";
2816
                    RowData[(int)GridColumn.SourceCode] = CurCode;
2817
                    // 増減フラグ
2818
                    if (SaveLineCnt > 0) { RowData[(int)GridColumn.FluctuationFlg] = (int)ConstructionLedgerDetail.FlucFlgDef.Fluctuates; }
2819

  
2820
                    // 行セット
2821
                    CreateDataRow(RowData);
2822
                    // 行位置取得
2823
                    int CurRow = dgv.RowCount - 1;
2824
                    if (SaveLineCnt < 0) SaveLineCnt = CurRow;
2825

  
2826
                    // 色を付ける
2827
                    dgv.Rows[CurRow].Cells[(int)GridColumn.No].Style.BackColor = CommonDefine.DefineColorList[nRowCnt];
2828

  
2829
                    nRowCnt++;
2830
                }
2831
                // 行位置セット
2832
                m_CostsRowCount[(int)CostsRowLine.NetIncomeRowLine] = SaveLineCnt;
2833
            }
2834
            catch (Exception ex)
2835
            {
2836
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
2837
            }
2838
        }
2839
        #endregion
2840

  
2663 2841
        #region 予算超過金額セット
2664 2842
        /// <summary>
2665 2843
        /// 予算超過金額セット
......
3180 3358
                strcmd.Append(", ifnull(Odr.OrdersLinePrice, 0) As OrderPrice");
3181 3359
                strcmd.Append(", ifnull(Odr2.StatutoryWelfareRate, 0.0)");
3182 3360

  
3361
                strcmd.Append(", CASE WHEN BudgetHead.OrdersDecisionPrice > 0 THEN BudgetHead.OrdersDecisionPrice");
3362
                strcmd.Append("  ELSE BASE.OrdersDecisionPrice END");
3363
                strcmd.Append(", Budget1.SumOdrVal");
3364
                strcmd.Append(", Budget1.SumExecVal");
3365
                strcmd.Append(", Budget2.SumOdrVal");
3366
                strcmd.Append(", Budget2.SumExecVal");
3367
                strcmd.Append(", Budget3.SumOdrVal");
3368
                strcmd.Append(", Budget3.SumExecVal");
3369
                strcmd.Append(", Budget4.SumOdrVal");
3370
                strcmd.Append(", Budget4.SumExecVal");
3371

  
3183 3372
                strcmd.Append(" FROM CONSTRUCTIONLEDGERDETAIL AS A");
3373

  
3374
                strcmd.Append("   INNER JOIN CONSTRUCTIONBASEINFO AS BASE");
3375
                strcmd.Append("         ON BASE.CONSTRUCTIONCODE = A.SourceCode");
3376

  
3184 3377
                strcmd.Append("   LEFT JOIN CONSTRUCTIONLEDGEREXCUTE AS B");
3185 3378
                strcmd.Append("         ON B.CONSTRUCTIONCODE = A.CONSTRUCTIONCODE");
3186 3379
                strcmd.Append("         AND B.GROUPCOUNT = A.GROUPCOUNT");
3187 3380
                strcmd.Append("         AND B.LINECOUNT = A.LINECOUNT");
3188 3381

  
3382
                //strcmd.Append("      LEFT JOIN(Select OdrA.ConstructionCode, OdrA.SourceDetailCnt, SUM(OdrA.OrdersLinePrice) As OrdersLinePrice");
3383
                //strcmd.Append("                From PurchaseOrderDetail As OdrA");
3384
                //strcmd.AppendFormat("          Where OdrA.GroupCount in ({0}, {1})", (int)PurchaseOrderDetail.GroupCountDef.Detail
3385
                //                                                                    , (int)PurchaseOrderDetail.GroupCountDef.StatutoryWelfare);
3386
                //strcmd.AppendFormat("          Group By OdrA.ConstructionCode, OdrA.SourceDetailCnt) As Odr");
3387
                //strcmd.AppendFormat("    ON Odr.ConstructionCode = A.SourceCode");
3388
                //strcmd.AppendFormat("    And Odr.SourceDetailCnt = A.DetailCount");
3389

  
3189 3390
                strcmd.Append("   LEFT JOIN PurchaseOrderDetail As Odr");
3190
                strcmd.Append("         ON Odr.ConstructionCode = A.ConstructionCode");
3191
                strcmd.Append("         And Odr.SourceCode = A.SourceCode");
3391
                strcmd.Append("         ON Odr.ConstructionCode = A.SourceCode");
3392
                strcmd.Append("         And Odr.SourceCode = A.ConstructionCode");
3192 3393
                strcmd.Append("         And Odr.SourceDetailCnt = A.DetailCount");
3193 3394

  
3194 3395
                strcmd.Append("   LEFT JOIN PurchaseOrderDetail As Odr2");
......
3196 3397
                strcmd.Append("         And Odr2.SeqNo = Odr.SeqNo");
3197 3398
                strcmd.AppendFormat("   And Odr2.GroupCount = {0}", (int)PurchaseOrderDetail.GroupCountDef.StatutoryWelfare);
3198 3399

  
3400
                strcmd.Append("   LEFT JOIN constructionbudget As BudgetHead");
3401
                strcmd.Append("         ON BudgetHead.ConstructionCode = A.SourceCode");
3402

  
3403
                // 経費取得
3404
                strcmd.Append("   LEFT JOIN(Select Bdd.ConstructionCode, EstSum.PriceValue As SumOdrVal, SUM(Bdd.ExecutionAmount) As SumExecVal");
3405
                strcmd.Append("             From ConstructionBudgetdetail As Bdd");
3406
                strcmd.Append("                  Left Join(Select EstSumA.ConstructionCode, SUM(EstSumA.PriceValue) AS PriceValue From estimatedata As EstSumA");
3407
                strcmd.AppendFormat("                      Where EstSumA.ConstructionCode = {0}", m_ConstructionCode);
3408
                strcmd.AppendFormat("                      And EstSumA.ComponentCode in ({0}, {1})) As EstSum"
3409
                                                                                                    , m_CommonCosts.NormalManagementPublic
3410
                                                                                                    , m_CommonCosts.NormalManagementPrivate);
3411
                strcmd.Append("                       On EstSum.ConstructionCode = Bdd.ConstructionCode");
3412
                strcmd.AppendFormat("       WHERE Bdd.GroupCount = {0}", (int)FrmConstructionBudget.DataGroup.Expenses);
3413
                strcmd.Append("             Group By Bdd.ConstructionCode) As Budget1 ON Budget1.ConstructionCode = A.SourceCode");
3414

  
3415
                // 施工費取得
3416
                strcmd.Append("   LEFT JOIN(Select Bdd.ConstructionCode, SUM(Bdd.NegotiationPrice) As SumOdrVal, SUM(Bdd.ExecutionAmount) As SumExecVal");
3417
                strcmd.Append("             From ConstructionBudgetdetail As Bdd");
3418
                strcmd.AppendFormat("       WHERE Bdd.GroupCount In ({0}, {1}, {2})", (int)FrmConstructionBudget.DataGroup.CommonTempCosts
3419
                                                                                    , (int)FrmConstructionBudget.DataGroup.OutSourceCosts
3420
                                                                                    , (int)FrmConstructionBudget.DataGroup.MyConstruction);
3421
                strcmd.Append("             Group By Bdd.ConstructionCode) As Budget2 ON Budget2.ConstructionCode = A.SourceCode");
3422

  
3423
                // 諸経費取得
3424
                strcmd.Append("   LEFT JOIN(Select Bdd.ConstructionCode, SUM(Bdd.NegotiationPrice) As SumOdrVal, SUM(Bdd.ExecutionAmount) As SumExecVal");
3425
                strcmd.Append("             From ConstructionBudgetdetail As Bdd");
3426
                strcmd.AppendFormat("       Where Bdd.GroupCount In ({0}, {1}, {2}, {3}, {4}, {5})"
3427
                                                                                    , (int)FrmConstructionBudget.DataGroup.PurchaseCosts
3428
                                                                                    , (int)FrmConstructionBudget.DataGroup.VehicleLeaseFee
3429
                                                                                    , (int)FrmConstructionBudget.DataGroup.TransportationCosts
3430
                                                                                    , (int)FrmConstructionBudget.DataGroup.ParkingCosts
3431
                                                                                    , (int)FrmConstructionBudget.DataGroup.RoomChargeCosts
3432
                                                                                    , (int)FrmConstructionBudget.DataGroup.DisposeCosts);
3433
                strcmd.Append("             Group By Bdd.ConstructionCode) As Budget3 ON Budget3.ConstructionCode = A.SourceCode");
3434

  
3435
                // 人件費取得
3436
                strcmd.Append("   LEFT JOIN(Select Bdd.ConstructionCode, EstSum.PriceValue As SumOdrVal, SUM(Bdd.ExecutionAmount) As SumExecVal");
3437
                strcmd.Append("             From ConstructionBudgetdetail As Bdd");
3438
                strcmd.Append("                  Left Join(Select EstSumA.ConstructionCode, SUM(EstSumA.PriceValue) AS PriceValue From estimatedata As EstSumA");
3439
                strcmd.AppendFormat("                      Where EstSumA.ConstructionCode = {0}", m_ConstructionCode);
3440
                strcmd.AppendFormat("                      And EstSumA.ComponentCode in ({0}, {1})) As EstSum", m_CommonCosts.FieldManagementPublic
3441
                                                                                                    , m_CommonCosts.FieldManagementPrivate);
3442
                strcmd.Append("                       On EstSum.ConstructionCode = Bdd.ConstructionCode");
3443
                strcmd.AppendFormat("       Where Bdd.GroupCount In ({0}, {1}, {2})"
3444
                                                                                    , (int)FrmConstructionBudget.DataGroup.InstructorCosts
3445
                                                                                    , (int)FrmConstructionBudget.DataGroup.AssistantCosts
3446
                                                                                    , (int)FrmConstructionBudget.DataGroup.PayrollExpenses);
3447
                strcmd.Append("             Group By Bdd.ConstructionCode) As Budget4 ON Budget4.ConstructionCode = A.SourceCode");
3448

  
3199 3449
                strcmd.AppendFormat(" WHERE A.CONSTRUCTIONCODE = {0}", m_ConstructionCode);
3200 3450
                strcmd.Append(" ORDER BY A.GROUPCOUNT ASC, A.LINECOUNT ASC, A.DETAILCOUNT ASC, B.COLUMNCOUNT ASC");
3201 3451

  
......
3208 3458

  
3209 3459
        #endregion
3210 3460

  
3461
        #region 表示データ読込順
3462
        /// <summary>
3463
        /// 表示データ読込順
3464
        /// </summary>
3465
        private enum DetailReadOrder
3466
        {
3467
            /// <summary>
3468
            /// +0:支払年月
3469
            /// </summary>
3470
            TargetMonth,
3471
            /// <summary>
3472
            /// +1:支払金額
3473
            /// </summary>
3474
            PaymentAmount,
3475
            /// <summary>
3476
            /// +2:注文書発注金額
3477
            /// </summary>
3478
            OrdersLinePrice,
3479
            /// <summary>
3480
            /// +3:法定福利費率
3481
            /// </summary>
3482
            StatutoryWelfareRate,
3483
            /// <summary>
3484
            /// +4:受注金額
3485
            /// </summary>
3486
            OrdersPrice,
3487
            /// <summary>
3488
            /// +5:工事予算書:経費(予算)
3489
            /// </summary>
3490
            Budget1_SumOdrVal,
3491
            /// <summary>
3492
            /// +6:工事予算書:経費(実行)
3493
            /// </summary>
3494
            Budget1_SumExecVal,
3495
            /// <summary>
3496
            /// +7:工事予算書:施工費(予算)
3497
            /// </summary>
3498
            Budget2_SumOdrVal,
3499
            /// <summary>
3500
            /// +8:工事予算書:施工費(実行)
3501
            /// </summary>
3502
            Budget2_SumExecVal,
3503
            /// <summary>
3504
            /// +9:工事予算書:諸経費(予算)
3505
            /// </summary>
3506
            Budget3_SumOdrVal,
3507
            /// <summary>
3508
            /// +10:工事予算書:諸経費(実行)
3509
            /// </summary>
3510
            Budget3_SumExecVal,
3511
            /// <summary>
3512
            /// +11:工事予算書人件費(予算)
3513
            /// </summary>
3514
            Budget4_SumOdrVal,
3515
            /// <summary>
3516
            /// +12:工事予算書人件費(実行)
3517
            /// </summary>
3518
            Budget4_SumExecVal,
3519
        }
3520
        #endregion
3521

  
3211 3522
        #region 工事詳細台帳よりデータを取得する
3212 3523
        /// <summary>
... 差分の行数が表示可能な上限を超えました。超過分は表示しません。

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