プロジェクト

全般

プロフィール

リビジョン 79

山内7年以上前に追加

請求入力修正(結合工事対応)、MySQLエラー修正

差分を表示:

branches/src/ProcessManagement/ProcessManagement/Common/Process/ClsChangeLedgerData.cs
89 89
                                                                , GetConstructionLedgerGroupNo((int)CommonDefine.CostDataNo.Lease)
90 90
                                                                , GetConstructionLedgerGroupNo((int)CommonDefine.CostDataNo.StoragePlace)
91 91
                                                                , GetConstructionLedgerGroupNo((int)CommonDefine.CostDataNo.Lodging));
92
                strDelSQL += string.Format(" AND TARGETMONTH = TO_DATE('{0}','YYYY/MM/DD')", (TargetMonth + "/01"));
92
                strDelSQL += string.Format(" AND TARGETMONTH = STR_TO_DATE('{0}','%Y/%m/%d')", (TargetMonth + "/01"));
93 93
                LedgerExcuteDB.ExecuteNonQuery(strDelSQL, false);
94 94

  
95 95
                for (int i = (int)CommonDefine.CostDataNo.Transport; i <= (int)CommonDefine.CostDataNo.Lodging; i++)
96 96
                {
97
                    string strSQL = "SELECT CONSTRUCTIONCODE, DATATYPE, TO_CHAR(ACTIONDATE,'YYYY/MM'), SUM(ENTRYPRICE) FROM COSTDATAOFPERSON";
98
                    strSQL += String.Format(" WHERE TO_CHAR(ACTIONDATE,'YYYY/MM') = '{0}'", TargetMonth);
97
                    string strSQL = "SELECT CONSTRUCTIONCODE, DATATYPE, DATE_FORMAT(ACTIONDATE,'%Y/%m'), SUM(ENTRYPRICE) FROM COSTDATAOFPERSON";
98
                    strSQL += String.Format(" WHERE DATE_FORMAT(ACTIONDATE,'%Y/%m') = '{0}'", TargetMonth);
99 99
                    strSQL += String.Format(" AND DATATYPE = {0}", i);
100 100
                    strSQL += " AND CONSTRUCTIONCODE IN (SELECT A1.CONSTRUCTIONCODE FROM CONSTRUCTIONBASEINFO A1";
101 101
                    strSQL += string.Format(" WHERE (A1.SALESPERSONCODE = {0} OR A1.CONSTRUCTIONPERSONCODE = {0} OR A1.CONSTRSUBPERSONCODE = {0} OR A1.CONSTRUCTIONINSTRUCTOR = {0}))", PersonCode);
102
                    strSQL += " GROUP BY CONSTRUCTIONCODE, DATATYPE, TO_CHAR(ACTIONDATE,'YYYY/MM')";
102
                    strSQL += " GROUP BY CONSTRUCTIONCODE, DATATYPE, DATE_FORMAT(ACTIONDATE,'%Y/%m')";
103 103
                    strSQL += " ORDER BY CONSTRUCTIONCODE, DATATYPE";
104 104
                    ArrayList arList = new ArrayList();
105 105
                    if (!CostDB.ExecuteReader(strSQL, ref arList, false)) continue;
......
319 319
            FrmConstructionLedger frm = new FrmConstructionLedger();
320 320
            try
321 321
            {
322
                string strSQL = "SELECT PERSONCODE, TO_CHAR(ACTIONDATE,'YYYY/MM'), CONSTRUCTIONCODE FROM COSTDATAOFPERSON";
323
                strSQL += String.Format(" WHERE PERSONCODE = {0} AND TO_CHAR(ACTIONDATE,'YYYY/MM') = '{1}'", PersonCode, TargetMonth);
324
                strSQL += " GROUP BY PERSONCODE, TO_CHAR(ACTIONDATE,'YYYY/MM'), CONSTRUCTIONCODE";
322
                string strSQL = "SELECT PERSONCODE, DATE_FORMAT(ACTIONDATE,'%Y/%m'), CONSTRUCTIONCODE FROM COSTDATAOFPERSON";
323
                strSQL += String.Format(" WHERE PERSONCODE = {0} AND DATE_FORMAT(ACTIONDATE,'%Y/%m') = '{1}'", PersonCode, TargetMonth);
324
                strSQL += " GROUP BY PERSONCODE, DATE_FORMAT(ACTIONDATE,'%Y/%m'), CONSTRUCTIONCODE";
325 325
                strSQL += " ORDER BY CONSTRUCTIONCODE";
326 326

  
327 327
                ArrayList arList = new ArrayList();
......
537 537
                    int NowValue = 0;
538 538
                    string strExecout = "SELECT PAYMENTAMOUNT FROM CONSTRUCTIONLEDGEREXCUTE";
539 539
                    strExecout += LedgerExDB.CreatePrimarykeyString(CurRec.ConstructionCode, CurRec.GroupCount, CurRec.LineCount);
540
                    strExecout += string.Format(" AND TargetMonth = TO_DATE('{0}')", DateTimeUtil.BeginOfMonth(TargetDate).ToShortDateString());
540
                    strExecout += string.Format(" AND TargetMonth = STR_TO_DATE('{0}', '%y/%m/%d')", DateTimeUtil.BeginOfMonth(TargetDate).ToShortDateString());
541 541
                    ArrayList arExecList = new ArrayList();
542 542
                    LedgerExDB.ExecuteReader(strExecout, ref arExecList, false);
543 543
                    if (arExecList.Count != 0)
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Request/RequestInput/FrmRequestInput.cs
140 140
        /// </summary>
141 141
        private void FrmRequestInput_Load(object sender, EventArgs e)
142 142
        {
143
            int ret;
143
            string msg = "";
144 144

  
145 145
            // 初期起動チェック
146
            ret = CheckInit();
147
            if (ret > 0)
148
            {
149
                ShowMessageBox("該当工事は結合工事の子工事として請求済のため、単独での請求はできません。", "請求入力", MessageBoxButtons.OK, MessageBoxIcon.Error);
146
            if( CheckInit(ref msg) == false ){
147
                ShowMessageBox(msg, "請求入力", MessageBoxButtons.OK, MessageBoxIcon.Error);
150 148

  
151
                this.Close();
149
                m_EndButton = DialogResult.Cancel;
152 150

  
153
                return;
154
            }
155
            else if (ret == -1)
156
            {
157
                ShowMessageBox("起動に失敗しました。再起動してください", "請求入力", MessageBoxButtons.OK, MessageBoxIcon.Error);
151
                // 前プロセスに戻る
152
                ClsExcute.BackProcess();
158 153

  
159
                this.Close();
160

  
161 154
                return;
162 155
            }
163 156

  
......
216 209
        private void FrmRequestInput_Activated(object sender, EventArgs e)
217 210
        {
218 211
            // 再描画
219
            //this.Refresh();
212
            this.Refresh();
220 213
        }
221 214

  
222 215
        /// <summary>
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Request/RequestInput/FrmRequestInputAuxiliary.cs
561 561
        /// <summary>
562 562
        /// 初期起動時チェック
563 563
        /// </summary>
564
        private int CheckInit()
564
        private bool CheckInit(ref string msg)
565 565
        {
566
            int ret;
567
            string wrk ;
566
            string sql;
568 567

  
569
            StringBuilder sql = new StringBuilder();
570
            IOConstructionLink ioLink = new IOConstructionLink();
571
            IORequestData ioData = new IORequestData();
568
            IOConstructionBaseInfo ioInfo = new IOConstructionBaseInfo();
569
            IORequestHead ioReqHead = new IORequestHead();
572 570

  
573
            List<ConstructionLink> lstLink = new List<ConstructionLink>();
574
            ArrayList ar = new ArrayList();
571
            msg = "起動に失敗しました。";
575 572

  
576
            ret = -1;
577

  
578 573
            try{
579
                wrk = string.Format(" Where FluctuationCode = {0}", m_ConstructionCode);
580

  
581
                if(ioLink.SelectAction(wrk, ref lstLink ) == false){
582
                    return -1;
574
                // 工事基本情報の取得
575
                ConstructionBaseInfo Info = new ConstructionBaseInfo();
576
                sql = ioInfo.CreatePrimarykeyString(m_ConstructionCode);
577
                if (ioInfo.SelectAction(sql, ref Info) == false)
578
                {
579
                    return false;
583 580
                }
584 581

  
585
                // 独立系はOK
586
                if( lstLink.Count == 0)
582
                // 結合親工事の場合
583
                if (Info.JoinFlg == (int)CommonDefine.BaseInfoJoinFlg.JoinParent)
587 584
                {
588
                    return 0 ;
585
                    ////////////////////////////////////////////
586
                    // 子工事で既に請求が実施されているか確認
587
                    ////////////////////////////////////////////
588
                    sql = "SELECT";
589
                    sql += " ReqHead.RequestNo";
590
                    sql += " FROM";
591
                    sql += " ConstructionLink Link";
592
                    sql += " INNER JOIN RequestHead ReqHead ON Link.FluctuationCode = ReqHead.ReqConstructionCode";
593
                    sql += string.Format(" WHERE Link.ConstructionCode = {0} AND Link.LinkType = 1", m_ConstructionCode);
594

  
595
                    ArrayList ar = new ArrayList();
596

  
597
                    if (ioReqHead.ExecuteReader(sql, ref ar) == false)
598
                    {
599
                        return false;
600
                    }
601

  
602
                    // 既に請求済
603
                    if (ar.Count > 0)
604
                    {
605
                        msg = "既に子工事で請求済のため、選択工事での請求はできません。";
606

  
607
                        return false;
608
                    }
589 609
                }
610
                // 結合子工事の場合
611
                else if( Info.JoinFlg == (int)CommonDefine.BaseInfoJoinFlg.JoinChildren)
612
                {
613
                    ///////////////////////////////////////////
614
                    // 親工事で請求済か確認
615
                    ///////////////////////////////////////////
616
                    sql = "SELECT";
617
                    sql += " ReqHead.RequestNo";
618
                    sql += " FROM";
619
                    sql += " ConstructionLink Link";
620
                    sql += " INNER JOIN RequestHead ReqHead ON Link.ConstructionCode = ReqHead.ReqConstructionCode";
621
                    sql += string.Format(" WHERE Link.FluctuationCode = {0} AND Link.LinkType = 1", m_ConstructionCode);
590 622

  
591
                // 結合子の場合は、結合親の本工事として請求データが存在するか確認する
592
                sql.AppendLine("SELECT ");
593
                sql.AppendLine("dt.MainConstructionCode ");
594
                sql.AppendLine("FROM ");
595
                sql.AppendLine("RequestHead hd ");
596
                sql.AppendLine(",INNER JOIN RequestData dt ON hd.RequestNo = dt.RequestNo ");
597
                sql.AppendLine("WHERE  ");
598
                sql.AppendFormat("hd.ReqConstructionCode = {0}", lstLink[0].ConstructionCode);
599
                sql.AppendFormat("And dt.MainConstructionCode = {0}", m_ConstructionCode);
623
                    ArrayList ar = new ArrayList();
600 624

  
601
                if (ioData.ExecuteReader(sql.ToString(), ref ar) == false)
602
                {
603
                    return -1;
625
                    if (ioReqHead.ExecuteReader(sql, ref ar) == false)
626
                    {
627
                        return false;
628
                    }
629

  
630
                    // 既に請求済
631
                    if (ar.Count > 0)
632
                    {
633
                        msg = "既に親工事で請求済のため、選択工事での請求はできません。";
634

  
635
                        return false;
636
                    }
637

  
604 638
                }
605 639

  
606
                ret = ar.Count;
640
                return true;
607 641
            }
608 642
            catch (Exception ex)
609 643
            {
610 644
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
645

  
646
                return false;
611 647
            }
612 648
            finally
613 649
            {
614
                ioLink.close();
615
                ioLink = null;
616
                ioData.close();
617
                ioData = null;
650
                ioInfo.close();
651
                ioInfo = null;
652
                ioReqHead.close();
653
                ioReqHead = null;
618 654
            }
619

  
620
            return ret;
621 655
        }
622 656
        #endregion
623 657

  
......
1052 1086
                        ReqDetailMain = new RequestDataDetail();
1053 1087
                        ReqDetailMain.RequestNo = nRequestNo;
1054 1088
                        ReqDetailMain.MainConstructionCode = nMainConstructonCode;
1089
                        ReqDetailMain.ConstructionCode = nMainConstructonCode;
1055 1090
                        ReqDetailMain.ConstructionKind = 0;
1056 1091
                    }
1057 1092
                    lstDetail.Add(ReqDetailMain);
......
1065 1100
                            ReqDetailSub = new RequestDataDetail();
1066 1101
                            ReqDetailSub.RequestNo = nRequestNo;
1067 1102
                            ReqDetailSub.MainConstructionCode = nMainConstructonCode;
1103
                            ReqDetailSub.ConstructionCode = nConstructionCode;
1068 1104
                            ReqDetailSub.ConstructionKind = 1;
1069 1105
                        }
1070 1106

  
......
1648 1684

  
1649 1685
                    dic.TryGetValue(key, out lst);
1650 1686

  
1651
                    for (int j = 0; j < lst.Count; j++)
1687
                    if (lst != null)
1652 1688
                    {
1653
                        setAmount(tcol, trow, lst[j].RequestAmount);
1654
                        setAmount(tcol, trow + 1, lst[j].TaxAmount);
1689
                        for (int j = 0; j < lst.Count; j++)
1690
                        {
1691
                            setAmount(tcol, trow, lst[j].RequestAmount);
1692
                            setAmount(tcol, trow + 1, lst[j].TaxAmount);
1655 1693

  
1656
                        if (nState == (int)ApprovalState.Entry)
1657
                        {
1658
                            dgv1[tcol, trow].ReadOnly = (m_bEdit == true ? (false):(true));
1659
                            dgv1[tcol, trow + 1].ReadOnly = (m_bEdit == true ? (false) : (true));
1694
                            if (nState == (int)ApprovalState.Entry)
1695
                            {
1696
                                dgv1[tcol, trow].ReadOnly = (m_bEdit == true ? (false) : (true));
1697
                                dgv1[tcol, trow + 1].ReadOnly = (m_bEdit == true ? (false) : (true));
1698
                            }
1699
                            trow += 2;
1660 1700
                        }
1701
                    }
1702
                    else
1703
                    {
1661 1704
                        trow += 2;
1662 1705
                    }
1663 1706

  

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