プロジェクト

全般

プロフィール

リビジョン 115

堀内7年以上前に追加

部署別台帳一覧/工事台帳まとめ、退職者担当工事表示修正
工事台帳担当者変更時、台帳明細データ予算・実行金額設定無へ変更

差分を表示:

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

  
19 19
        /// <summary>
20 20
        /// コピー・環境バージョン
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionBaseInfo/DataChange.cs
1200 1200
                DetailRec.SecondString = string.Empty;                                      // ?H?????e
1201 1201
                DetailRec.CompanyType = (int)CommonDefine.CodeDataType.Person;              // ??????R?[?h?^?C?v
1202 1202
                DetailRec.CompanyCode = ConstructorCode;                                    // ??????R?[?h
1203
                DetailRec.ExecutionAmount = ExecutionAmount;                                // ???s???z
1204
                DetailRec.AmountConfigRate = AmountConfigRate;                              // ???z?\????
1203
                //DetailRec.ExecutionAmount = ExecutionAmount;                                // ???s???z
1204
                //DetailRec.AmountConfigRate = AmountConfigRate;                              // ???z?\????
1205 1205

  
1206 1206
                DetailRec.SalaryFlg = (int)CommonDefine.SalaryDevision.All;                 // ???^?U????
1207 1207
                DetailRec.SalaryDays = workingCount;                                        // ???^?U??????
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionLedgerList/FrmConstructionLedgerListAuxiliary.cs
633 633
                CommonMotions.GetBeginningMonthDay(bPeriod, ref month, ref day);
634 634
                dtStart = new DateTime(iYear, month, day);
635 635
                dtEnd = dtStart.AddYears(1).AddDays(-1);     // ?I????{1?N?|1??
636

  
637
                // ????????????????t?????v?Z????
638
                if (CommonMotions.cnvInt(numUDConstPro.Value) == CommonMotions.SystemMasterData.BusinessPeriod) dtEnd = DateTime.Today;
639

  
640 636
            }
641 637
            catch (Exception ex)
642 638
            {
......
917 913
            /// ??p?J?n???t
918 914
            /// </summary>
919 915
            HireStartDays,
916
            /// <summary>
917
            /// ??p?I?????t
918
            /// </summary>
919
            HireCompDays,
920 920
        }
921 921
        #endregion
922 922

  
......
929 929
        /// <returns>?f?[?^????</returns>
930 930
        private int GetPersonInDepartment(ref List<int> PersonCodeList, ref List<DateTime> dtStartList,
931 931
                                            ref List<DateTime> dtCompList, ref List<DateTime> dtMaxComp,
932
                                            ref List<int> MonthSalaryList, ref List<DateTime> dtHireStDays)
932
                                            ref List<int> MonthSalaryList, ref List<DateTime> dtHireStDays, ref List<DateTime> dtHireEdDays)
933 933
        {
934 934
            IOMPersonInCharge PersonDB = new IOMPersonInCharge();
935 935
            try
......
947 947
                strSQL += " MAX(E.CONSTRUCTIONPERIODEND) I3, MAX(E.CONSTRUCTIONPERIODEND2) I4,";
948 948
                strSQL += " SUM(C.EXECUTIONAMOUNT) M5, SUM(D.EXECUTIONAMOUNT) S5, SUM(E.EXECUTIONAMOUNT) I5,";
949 949
                strSQL += " COUNT(C.EXECUTIONAMOUNT) M6, COUNT(D.EXECUTIONAMOUNT) S6, COUNT(E.EXECUTIONAMOUNT) I6,";
950
                strSQL += " P.STARTDATE";
950
                strSQL += " P.STARTDATE, P.ENDDATE";
951 951
                strSQL += " FROM PERSONINCHARGEMASTER P";
952 952

  
953 953
                // ?H???S?????f?[?^??
......
997 997

  
998 998
                strSQL += " GROUP BY A.DEPARTMENTCODE, A.DEPARTMENTSTRING, A.DISPLAYORDER) AS TMP )";
999 999

  
1000
                // 16???????t?H?[????_?????????????
1001
                if (numUDConstPro.Value < 17 && DepartmentCode == 9)
1002
                {
1003
                }
1004
                else
1005
                {
1006
                    strSQL += string.Format(" AND P.EMPLOYEECLASSFLG = {0}", (int)CommonDefine.EmployeeClassFlg.Regular);
1007
                }
1008 1000
                // ?????R?[?h?I?????????????????????????
1009 1001
                if (DepartmentCode != 0) strSQL += string.Format(" AND P.DEPARTMENTCODE = {0}", DepartmentCode);
1010 1002
                if (PersonCode != 0) strSQL += string.Format(" AND P.PERSONCODE = {0}", PersonCode);
1011 1003

  
1012
                strSQL += " GROUP BY P.PERSONCODE, P.PERSONNAME, P.DISPLAYORDER, P.MonthlySalary, P.STARTDATE";
1004
                strSQL += " GROUP BY P.PERSONCODE, P.PERSONNAME, P.DISPLAYORDER, P.MonthlySalary, P.STARTDATE, P.ENDDATE";
1013 1005
                strSQL += " ORDER BY P.DISPLAYORDER";
1014 1006

  
1015 1007
                ArrayList arList = new ArrayList();
......
1052 1044
                    // ???z???^????????
1053 1045
                    int Salary = CommonMotions.cnvInt(objRec[(int)GetPersonTerm.MonthlySalary]);
1054 1046

  
1055
                    // ??p?J?n??????????
1056
                    DateTime dtHireDay = CommonMotions.cnvDate(objRec[(int)GetPersonTerm.HireStartDays]);
1047
                    // ??p?J?n?E?I????????????
1048
                    DateTime dtHireStDay = CommonMotions.cnvDate(objRec[(int)GetPersonTerm.HireStartDays]);
1049
                    DateTime dtHireEdDay = CommonMotions.cnvDate(objRec[(int)GetPersonTerm.HireCompDays]);
1057 1050

  
1058 1051
                    PersonCodeList.Add(Person);     // ?S????R?[?h
1059 1052
                    dtStartList.Add(stDate);        // ?J?n??
1060 1053
                    dtCompList.Add(edDate);         // ?I????
1061 1054
                    dtMaxComp.Add(maxDate);         // ???I????
1062 1055
                    MonthSalaryList.Add(Salary);    // ???^???z
1063
                    dtHireStDays.Add(dtHireDay);    // ??p?J?n??
1056
                    dtHireStDays.Add(dtHireStDay);  // ??p?J?n??
1057
                    dtHireEdDays.Add(dtHireEdDay);  // ??p?I????
1064 1058
                }
1065 1059
                return arList.Count;
1066 1060
            }
......
1519 1513
                List<DateTime> dtMaxCompArray = new List<DateTime>();
1520 1514
                List<int> SalaryArray = new List<int>();
1521 1515
                List<DateTime> dtHireStDays = new List<DateTime>();
1522
                GetPersonInDepartment(ref PersonCDArray, ref dtStartArray, ref dtCompArray, ref dtMaxCompArray, ref SalaryArray, ref dtHireStDays);
1516
                List<DateTime> dtHireEdDays = new List<DateTime>();
1517
                GetPersonInDepartment(ref PersonCDArray,
1518
                                        ref dtStartArray, ref dtCompArray,
1519
                                        ref dtMaxCompArray, ref SalaryArray,
1520
                                        ref dtHireStDays, ref dtHireEdDays);
1523 1521

  
1524 1522
                // ProgressBar??l???X????
1525 1523
                prgber.Value++;
1526 1524
                prgber.Update();
1527 1525

  
1526
                // ?f?t?H???g?J?n?E?I??????????
1527
                DateTime dtDefaultStart = DateTime.MinValue;
1528
                DateTime dtDefaultEnd = DateTime.MinValue;
1529
                CreateDefaultStartAndEndDate(ref dtDefaultStart, ref dtDefaultEnd);
1530

  
1528 1531
                // ----- ?o????^?\???i?w?b?_?[??\???j
1529
                SetPayrollData(PersonCDArray, dtStartArray, dtCompArray, SalaryArray, dtMaxCompArray, dtHireStDays);
1532
                SetPayrollData(PersonCDArray, dtDefaultStart, dtDefaultEnd,
1533
                                dtStartArray, dtCompArray,
1534
                                SalaryArray, dtMaxCompArray,
1535
                                dtHireStDays, dtHireEdDays);
1530 1536

  
1531 1537
                // ----- ?o???\??????
1532 1538
                int Expenses = SetOtherCost(PersonCDArray, dtStartArray, dtCompArray);
......
1906 1912
        /// <param name="dtStartArray"></param>
1907 1913
        /// <param name="dtCompArray"></param>
1908 1914
        /// <param name="SalaryArray"></param>
1909
        private void SetPayrollData(List<int> PersonCDArray, List<DateTime> dtStartArray,
1910
                                    List<DateTime> dtCompArray, List<int> SalaryArray,
1911
                                    List<DateTime> dtMaxCompArray, List<DateTime> dtHireStDayArray)
1915
        private void SetPayrollData(List<int> PersonCDArray, DateTime dtDefaultStart, DateTime dtDefaultEnd,
1916
                                    List<DateTime> dtStartArray, List<DateTime> dtCompArray,
1917
                                    List<int> SalaryArray, List<DateTime> dtMaxCompArray,
1918
                                    List<DateTime> dtHireStDayArray, List<DateTime> dtHireEdDayArray)
1912 1919
        {
1913 1920
            try
1914 1921
            {
1922
                //Debug.WriteLine("---------------------");
1915 1923
                // ?????R?[?h??
1916 1924
                int DepartmentCode = GetDepartmentCode();
1917 1925

  
1918 1926
                // ??????????E??????????
1919
                DateTime dtDefaultStart = DateTime.MinValue;
1920
                DateTime dtDefaultEnd = DateTime.MinValue;
1921
                CreateDefaultStartAndEndDate(ref dtDefaultStart, ref dtDefaultEnd);
1927
                DateTime dtCurDefaultStart = dtDefaultStart;
1928
                DateTime dtCurDefaultEnd = dtDefaultEnd;
1922 1929

  
1923 1930
                int TotalSalary = 0;        // ???^????
1924 1931
                int OnSalary = 0;           // ?U?????^???z??
......
1933 1940
                // ???^???W?v????
1934 1941
                for (int i = 0; i < PersonCDArray.Count; i++)
1935 1942
                {
1943
                    // ??????????E??????????
1944
                    dtCurDefaultStart = dtDefaultStart;
1945
                    dtCurDefaultEnd = dtDefaultEnd;
1946

  
1947
                    // ???????????????J?n???????????
1948
                    if (dtDefaultStart < dtHireStDayArray[i] && dtHireStDayArray[i] < dtDefaultEnd)
1949
                    {
1950
                        dtCurDefaultStart = dtHireStDayArray[i];
1951
                    }
1952
                    // ??????????????I????????????
1953
                    if (dtDefaultStart < dtHireEdDayArray[i] && dtHireEdDayArray[i] < dtDefaultEnd)
1954
                    {
1955
                        dtCurDefaultEnd = dtHireEdDayArray[i];
1956
                    }
1957

  
1936 1958
                    // ?J?n????
1937 1959
                    dtStart = dtStartArray[i];
1938 1960
                    // ?f?[?^?????????????????Z?b?g????
1939 1961
                    if (dtStart == DateTime.MaxValue)
1940 1962
                    {
1941
                        if (dtDefaultStart < dtHireStDayArray[i] && dtHireStDayArray[i] < dtDefaultEnd)
1942
                            dtStart = dtHireStDayArray[i];
1943
                        else
1944
                            dtStart = dtDefaultStart;
1963
                        dtStart = dtCurDefaultStart;
1945 1964
                    }
1946
                    else if (dtDefaultStart < dtStart)
1947
                    {   // ?J?n?????????????????O??f?[?^???????????`?F?b?N????
1948
                        dtStart = dtDefaultStart;
1965
                    else if (dtCurDefaultStart < dtStart)
1966
                    {   // ?J?n?????????????????????Z?b?g????
1967
                        dtStart = dtCurDefaultStart;
1949 1968
                    }
1950
                    // ?I??????
1951
                    dtEnd = dtCompArray[i];
1952
                    if (dtEnd == DateTime.MinValue) dtEnd = dtDefaultEnd;
1969

  
1953 1970
                    // ??????
1954 1971
                    dtMax = dtMaxCompArray[i];
1955
                    if (dtMax == DateTime.MinValue) dtMax = dtDefaultEnd;
1972
                    if (dtMax == DateTime.MinValue) dtMax = dtCurDefaultEnd;
1973
                    // ???????????????????
1974
                    if (dtMax < DateTime.Today.Date)
1975
                    {
1976
                        if (numUDConstPro.Value < CommonMotions.SystemMasterData.BusinessPeriod)
1977
                        {   // ?O????O?????
1978
                            dtMax = dtCurDefaultEnd;
1979
                        }
1980
                        else if (dtHireEdDayArray[i] != DateTime.MinValue && dtDefaultStart < dtHireEdDayArray[i] && dtHireEdDayArray[i] < dtDefaultEnd)
1981
                        {   // ??????????????I????????????
1982
                            dtMax = dtCurDefaultEnd;
1983
                        }
1984
                        else
1985
                        {   // ??O?????
1986
                            dtMax = DateTime.Today.Date;
1987
                        }
1988
                    }
1956 1989

  
1957 1990
                    // ???^????
1958
                    int workSalary = CalcElapsedSalary(dtStart, dtEnd, PersonCDArray[i], SalaryArray[i]);
1991
                    int workSalary = CalcElapsedSalary(dtStart, dtMax, PersonCDArray[i], SalaryArray[i]);
1959 1992
                    // ??v???Z
1960 1993
                    if (workSalary > 0) TotalSalary += workSalary;
1994
                    //Debug.WriteLine(string.Format("Code={0} Val={1} Start={2} End={3}", PersonCDArray[i], workSalary.ToString("0,0"), dtStart, dtMax));
1961 1995

  
1962 1996
                    // ?v?Z?J?n?I????????????
1963 1997
                    if (dtStart < dtDispStart) dtDispStart = dtStart;
1964 1998
                    if (dtDispComplate < dtMax) dtDispComplate = dtMax;
1965 1999
                }
1966 2000

  
2001
                // ----- ?\??????
1967 2002
                // ?U?????^???z?E?????v???z?E?e???v???z??
1968 2003
                ProfitGeneral(ref OnSalary, ref  NetIncome, ref  NonSalary);
1969 2004

  
......
2013 2048
        /// <returns></returns>
2014 2049
        private int CalcElapsedSalary(DateTime dtStart, DateTime dtLast, int PersonCode, int Salary)
2015 2050
        {
2051
            IOMPersonSalary SalDB = new IOMPersonSalary();
2016 2052
            try
2017 2053
            {
2018
                // ???????????????
2019
                int WorkingDay = ClsCalendar.CalcPassedDaysCount(dtStart, dtLast);
2054
                int RetSalary = 0;
2020 2055

  
2021
                // ???^??
2022
                int MonthlyPay = CommonMotions.cnvRound(Salary * CommonDefine.s_SalaryCorrection);
2056
                string strSQL = "SELECT AX.hiduke,";
2057
                strSQL += string.Format(" ROUND((AX.salary * {0})/ {1}),", CommonDefine.s_SalaryCorrection, CommonDefine.s_ManHourUnitMonth);
2058
                strSQL += " MAX(AX.StartD) FROM";
2059
                strSQL += " (SELECT A.d hiduke, B.MonthlySalary salary, B.STARTDATE StartD FROM";
2023 2060

  
2024
                // ?????v?Z
2025
                double daylySalary = CommonMotions.cnvRound(MonthlyPay / CommonDefine.s_ManHourUnitMonth);
2061
                strSQL += " (SELECT A1.years, A2.month, A3.days, DATE(CONCAT(A1.years, '/', A2.month, '/', A3.days)) AS d";
2062
                strSQL += " FROM yearmaster AS A1, monthmaster AS A2, daymaster AS A3";
2026 2063

  
2027
                // ?o????^?v?Z
2028
                int RetSalary = CommonMotions.cnvRound(WorkingDay * daylySalary);
2064
                strSQL += " WHERE";
2065
                if (dtStart.Year == dtLast.Year)
2066
                {
2067
                    strSQL += string.Format(" (A1.years = {0} AND A2.month IN(", dtStart.Year.ToString("0000"));
2068
                    for (int i = dtStart.Month; i <= dtLast.Month; i++)
2069
                    {
2070
                        if (i != dtStart.Month) strSQL += ", ";
2071
                        strSQL += string.Format("{0} ", i);
2072
                    }
2073
                    strSQL += "))";
2074
                }
2075
                else
2076
                {
2077
                    strSQL += string.Format(" ((A1.years = {0} AND A2.month IN(", dtStart.Year.ToString("0000"));
2078
                    for (int i = dtStart.Month; i <= 12; i++)
2079
                    {
2080
                        if (i != dtStart.Month) strSQL += ", ";
2081
                        strSQL += string.Format("{0} ", i);
2082
                    }
2083
                    strSQL += "))";
2084
                    strSQL += string.Format(" OR (A1.years = {0} AND A2.month IN(", dtLast.Year.ToString("0000"));
2085
                    for (int i = 1; i <= dtLast.Month; i++)
2086
                    {
2087
                        if (i != 1) strSQL += ", ";
2088
                        strSQL += string.Format("{0} ", i);
2089
                    }
2090
                    strSQL += ")))";
2091
                }
2029 2092

  
2093
                strSQL += " AND DATE(CONCAT(A1.years, '/', A2.month, '/', A3.days)) IS NOT NULL";
2094
                strSQL += " ORDER BY d) A";
2095
                strSQL += ", PERSONSALARYMASTER AS B";
2096
                strSQL += " WHERE B.STARTDATE <= A.d";
2097
                strSQL += string.Format(" AND B.PERSONCODE = {0}", PersonCode);
2098
                strSQL += " ORDER BY A.d, B.STARTDATE DESC) AS AX";
2099
                strSQL += " GROUP BY AX.hiduke";
2100
                strSQL += " ORDER BY AX.hiduke";
2101

  
2102
                ArrayList ArData = new ArrayList();
2103
                SalDB.ExecuteReader(strSQL, ref ArData);
2104

  
2105
                foreach (object[] objRec in ArData)
2106
                {
2107
                    RetSalary += CommonMotions.cnvInt(objRec[1]);
2108
                }
2109

  
2030 2110
                return RetSalary;
2031 2111
            }
2032 2112
            catch (Exception ex)
......
2034 2114
                logger.ErrorFormat("?V?X?e???G???[?F{0}?F{1}", CommonMotions.GetMethodName(), ex.Message);
2035 2115
                return 0;
2036 2116
            }
2117
            finally
2118
            {
2119
                SalDB.close(); SalDB = null;
2120
            }
2037 2121
        }
2038 2122
        #endregion
2039 2123

  
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/DepExpenssList/FrmDepExpenssListAuxiliary.cs
835 835
                CommonMotions.GetBeginningMonthDay(bPeriod, ref month, ref day);
836 836
                dtStart = new DateTime(iYear, month, day);
837 837
                dtEnd = dtStart.AddYears(1).AddDays(-1);     // ?I????{1?N?|1??
838

  
839
                // ????????????????t?????v?Z????
840
                if (CommonMotions.cnvInt(numUDConstPro.Value) == CommonMotions.SystemMasterData.BusinessPeriod) dtEnd = DateTime.Today;
841

  
842 838
            }
843 839
            catch (Exception ex)
844 840
            {
......
946 942
            /// ??p?J?n???t
947 943
            /// </summary>
948 944
            HireStartDays,
945
            /// <summary>
946
            /// ??p?I?????t
947
            /// </summary>
948
            HireCompDays,
949 949
        }
950 950
        #endregion
951 951

  
......
959 959
        private int GetPersonInDepartment(ref List<int> DepartmentList, ref List<int> PersonCode,
960 960
                                            ref List<DateTime> dtStart, ref List<DateTime> dtComp,
961 961
                                            ref List<DateTime> dtMaxComp, ref List<int> MonthSalary,
962
                                            ref List<DateTime> dtHireStDays)
962
                                            ref List<DateTime> dtHireStDays, ref List<DateTime> dtHireEdDays)
963 963
        {
964 964
            IOMPersonInCharge PersonDB = new IOMPersonInCharge();
965 965
            try
......
976 976
                strSQL += " MAX(E.CONSTRUCTIONPERIODEND) I3, MAX(E.CONSTRUCTIONPERIODEND2) I4,";
977 977
                strSQL += " SUM(C2.EXECUTIONAMOUNT) M5, SUM(D2.EXECUTIONAMOUNT) S5, SUM(E2.EXECUTIONAMOUNT) I5,";
978 978
                strSQL += " COUNT(C2.EXECUTIONAMOUNT) M6, COUNT(D2.EXECUTIONAMOUNT) S6, COUNT(E2.EXECUTIONAMOUNT) I6,";
979
                strSQL += " P.STARTDATE";
979
                strSQL += " P.STARTDATE, P.ENDDATE";
980 980
                strSQL += " FROM PERSONINCHARGEMASTER P";
981 981
                
982 982
                // ?H???S?????f?[?^??
......
1014 1014
                strSQL += " AND D.CONSTRUCTIONCODE = C.CONSTRUCTIONCODE";
1015 1015
                strSQL += " GROUP BY A.DEPARTMENTCODE, A.DEPARTMENTSTRING, A.DISPLAYORDER) AS TMP )";
1016 1016

  
1017
                // 16???????t?H?[????_?????????????
1018
                if (numUDConstPro.Value <= 16 && DepartmentCode != 9)
1019
                {
1020
                    strSQL += string.Format(" AND P.EMPLOYEECLASSFLG = {0}", (int)CommonDefine.EmployeeClassFlg.Regular);
1021
                }
1022 1017
                if (DepartmentCode != 0)
1023 1018
                    strSQL += string.Format(" AND P.DEPARTMENTCODE = {0}", DepartmentCode);
1024
                strSQL += " GROUP BY P.DEPARTMENTCODE, P.PERSONCODE, P.PERSONNAME, P.DISPLAYORDER, P.MonthlySalary, P.STARTDATE";
1019
                strSQL += " GROUP BY P.DEPARTMENTCODE, P.PERSONCODE, P.PERSONNAME, P.DISPLAYORDER, P.MonthlySalary, P.STARTDATE, P.ENDDATE";
1025 1020
                strSQL += " ORDER BY P.DISPLAYORDER";
1026 1021

  
1027 1022
                ArrayList arList = new ArrayList();
......
1066 1061
                    // ???z???^????????
1067 1062
                    int Salary = CommonMotions.cnvInt(objRec[(int)GetPersonTerm.MonthlySalary]);
1068 1063

  
1069
                    // ??p?J?n??????????
1070
                    DateTime dtHireDay = CommonMotions.cnvDate(objRec[(int)GetPersonTerm.HireStartDays]);
1064
                    // ??p?J?n?E?I????????????
1065
                    DateTime dtHireStDay = CommonMotions.cnvDate(objRec[(int)GetPersonTerm.HireStartDays]);
1066
                    DateTime dtHireEdDay = CommonMotions.cnvDate(objRec[(int)GetPersonTerm.HireCompDays]);
1071 1067

  
1072 1068
                    DepartmentList.Add(Department);     // ?????R?[?h
1073 1069
                    PersonCode.Add(Person);             // ?S????R?[?h
......
1075 1071
                    dtComp.Add(edDate);                 // ?I????
1076 1072
                    dtMaxComp.Add(maxDate);             // ???I????
1077 1073
                    MonthSalary.Add(Salary);            // ???^???z
1078
                    dtHireStDays.Add(dtHireDay);        // ??p?J?n??
1074
                    dtHireStDays.Add(dtHireStDay);      // ??p?J?n??
1075
                    dtHireEdDays.Add(dtHireEdDay);      // ??p?I????
1079 1076
                }
1080 1077
                return arList.Count;
1081 1078
            }
......
1344 1341
                List<DateTime> dtMaxCompArray = new List<DateTime>();
1345 1342
                List<int> SalaryArray = new List<int>();
1346 1343
                List<DateTime> dtHireStDayArray = new List<DateTime>();
1347
                GetPersonInDepartment(ref DepInPerArray, ref PersonCDArray, ref dtStartArray, ref dtCompArray, ref dtMaxCompArray, ref SalaryArray, ref dtHireStDayArray);
1344
                List<DateTime> dtHireEdDayArray = new List<DateTime>();
1345
                GetPersonInDepartment(ref DepInPerArray, ref PersonCDArray,
1346
                                        ref dtStartArray, ref dtCompArray,
1347
                                        ref dtMaxCompArray, ref SalaryArray,
1348
                                        ref dtHireStDayArray, ref dtHireEdDayArray);
1348 1349

  
1349 1350
                // ProgressBar??l???X????
1350 1351
                prgber.Value++;
......
1355 1356
                DateTime dtDefaultEnd = DateTime.MinValue;
1356 1357
                CreateDefaultStartAndEndDate(ref dtDefaultStart, ref dtDefaultEnd);
1357 1358

  
1358

  
1359 1359
                // ----- ?o????^?\???i?w?b?_?[??\???j
1360
                SetPayrollData(PersonCDArray, dtStartArray, dtCompArray, SalaryArray, dtMaxCompArray, dtHireStDayArray);
1360
                SetPayrollData(PersonCDArray, dtDefaultStart, dtDefaultEnd,
1361
                                dtStartArray, dtCompArray,
1362
                                SalaryArray, dtMaxCompArray,
1363
                                dtHireStDayArray, dtHireEdDayArray);
1361 1364

  
1362 1365
                // ProgressBar??l???X????
1363 1366
                prgber.Value++;
......
1386 1389
                // ----- ?H????????
1387 1390
                if (!LedgerDB.ExecuteReader(strSQL, ref arData)) return;
1388 1391

  
1392
                // ???????????????E?????f?[?^???????\??????
1393
                if (DispType== (int)DispDataTypeCode.Department)
1394
                {
1395
                    GetType2DeleteData(LedgerDB, ref arData);
1396
                }
1397

  
1389 1398
                // ??????f?[?^?J?E???g??
1390 1399
                m_initDataCount = arData.Count;
1391 1400
                if (arData.Count == 0) return;
......
1538 1547
                strSQL += " ,SUM(A.GROSSPROFIT)";
1539 1548
                strSQL += " ,SUM(A.NETPROFIT)";
1540 1549

  
1541
                //strSQL += " FROM CONSTRUCTIONLEDGER A, CONSTRUCTIONBASEINFO B, PERSONINCHARGEMASTER C, DEPARTMENTMASTER D";
1542
                //strSQL += " WHERE A.CONSTRUCTIONCODE = B.CONSTRUCTIONCODE";
1543
                //strSQL += string.Format(" AND B.CONSTRUCTIONPERIOD = {0}", numUDConstPro.Value);
1544
                //strSQL += string.Format(" AND B.CONSTRUCTIONSTATUSFLG != {0}", NotOrder);
1545
                //strSQL += string.Format(" AND B.TyingFlg != {0}", (int)CommonDefine.BaseInfoTyingFlg.Tying);
1546
                //strSQL += " AND B.CONSTRUCTIONPERSONCODE = C.PERSONCODE";
1547
                //strSQL += " AND C.DEPARTMENTCODE = D.DEPARTMENTCODE";
1548

  
1549 1550
                strSQL += " FROM PERSONINCHARGEMASTER C";
1550 1551
                strSQL += " LEFT JOIN CONSTRUCTIONBASEINFO B ON B.CONSTRUCTIONPERSONCODE = C.PERSONCODE";
1551 1552
                strSQL += string.Format(" AND B.CONSTRUCTIONPERIOD = {0}", numUDConstPro.Value);
......
1555 1556
                strSQL += " DEPARTMENTMASTER D";
1556 1557
                strSQL += " WHERE B.CONSTRUCTIONPERSONCODE = C.PERSONCODE";
1557 1558
                strSQL += " AND C.DEPARTMENTCODE = D.DEPARTMENTCODE";
1559
                //strSQL += " AND C.DELETEFLG = 0";
1558 1560

  
1559 1561
                strSQL += " GROUP BY  C.DEPARTMENTCODE, D.DEPARTMENTSTRING, D.DISPLAYORDER";
1560 1562
                strSQL += " ORDER BY 3 ASC";
......
1604 1606
                strSQL += " LEFT JOIN CONSTRUCTIONLEDGER A ON A.CONSTRUCTIONCODE = B.CONSTRUCTIONCODE";
1605 1607
                strSQL += string.Format(" WHERE C.DEPARTMENTCODE = {0}", DepCode);
1606 1608
                strSQL += " AND C.DELETEFLG = 0";
1607
                strSQL += string.Format(" AND C.EMPLOYEECLASSFLG = {0}", (int)CommonDefine.EmployeeClassFlg.Regular);
1609
                //strSQL += string.Format(" AND C.EMPLOYEECLASSFLG = {0}", (int)CommonDefine.EmployeeClassFlg.Regular);
1608 1610
                strSQL += " GROUP BY C.DISPLAYORDER, C.PERSONCODE, C.PERSONNAME, C.EMPLOYEECLASSFLG";
1609 1611
                strSQL += " ORDER BY 11, 3 ASC";
1610 1612

  
......
1616 1618
        }
1617 1619
        #endregion
1618 1620

  
1621
        #region ???????????f?[?^??S?????f?[?^???????????
1622
        /// <summary>
1623
        /// ???????????f?[?^??S?????f?[?^???????????
1624
        /// </summary>
1625
        private void GetType2DeleteData(IOConstructionLedger LedgerDB, ref ArrayList arData)
1626
        {
1627
            string strSQL = string.Empty;
1628
            try
1629
            {
1630
                // SQL??A?N?Z?X????????????
1631
                string strSecurity = string.Empty;
1632
                CreateSecuritySQL(ref strSecurity);
1633

  
1634
                int NotOrder = CommonDefine.ProjectsStatus.First(x => x.Value.Equals("?? ?? ??")).Key;
1635
                int DepCode = CommonMotions.cnvInt(cmbDepartment.SelectedValue);
1636
                // ----- ?r?p?k??
1637
                // ????????f?[?^????
1638
                strSQL = "SELECT";
1639

  
1640
                strSQL += " C.PERSONCODE";
1641
                strSQL += " ,C.PERSONNAME";
1642
                strSQL += " ,C.DISPLAYORDER";
1643
                strSQL += " ,SUM(A.ORDERSDECISIONPRICE)";
1644
                strSQL += " ,SUM(A.COMPANYEXPENSES)";
1645
                strSQL += " ,SUM(A.DEPARTMENTEXPENSES)";
1646
                strSQL += " ,SUM(A.SALESEXPENSES)";
1647
                strSQL += " ,SUM(A.TOTALPAYMENT)";
1648
                strSQL += " ,SUM(A.GROSSPROFIT)";
1649
                strSQL += " ,SUM(A.NETPROFIT)";
1650
                strSQL += " ,C.EMPLOYEECLASSFLG";
1651

  
1652
                strSQL += " FROM PERSONINCHARGEMASTER C";
1653
                strSQL += " LEFT JOIN CONSTRUCTIONBASEINFO B ON B.CONSTRUCTIONPERSONCODE = C.PERSONCODE";
1654
                strSQL += string.Format(" AND B.CONSTRUCTIONPERIOD = {0}", numUDConstPro.Value);
1655
                strSQL += string.Format(" AND B.CONSTRUCTIONSTATUSFLG != {0}", NotOrder);
1656
                strSQL += string.Format(" AND B.TyingFlg != {0}", (int)CommonDefine.BaseInfoTyingFlg.Tying);
1657

  
1658
                strSQL += ", CONSTRUCTIONLEDGER A";
1659
                //strSQL += " LEFT JOIN CONSTRUCTIONLEDGER A ON A.CONSTRUCTIONCODE = B.CONSTRUCTIONCODE";
1660

  
1661
                strSQL += string.Format(" WHERE C.DEPARTMENTCODE = {0}", DepCode);
1662
                strSQL += " AND A.CONSTRUCTIONCODE = B.CONSTRUCTIONCODE";
1663

  
1664
                strSQL += " AND C.DELETEFLG != 0";
1665
                //strSQL += string.Format(" AND C.EMPLOYEECLASSFLG = {0}", (int)CommonDefine.EmployeeClassFlg.Regular);
1666

  
1667
                strSQL += " GROUP BY C.DISPLAYORDER, C.PERSONCODE, C.PERSONNAME, C.EMPLOYEECLASSFLG";
1668
                strSQL += " ORDER BY 11, 3 ASC";
1669

  
1670
                if (!LedgerDB.ExecuteReader(strSQL, ref arData)) return;
1671
            }
1672
            catch (Exception ex)
1673
            {
1674
                logger.ErrorFormat("?V?X?e???G???[?F{0}?F{1}", ex.Message, strSQL);
1675
            }
1676
        }
1677
        #endregion
1678

  
1619 1679
        #region ??????o????^??\??????
1620 1680
        /// <summary>
1621 1681
        /// ??????o????^??\??????
1622 1682
        /// </summary>
1623
        /// <param name="PersonCDArray"></param>
1624
        /// <param name="dtStartArray"></param>
1625
        /// <param name="dtCompArray"></param>
1626
        /// <param name="SalaryArray"></param>
1627
        private void SetPayrollData(List<int> PersonCDArray, List<DateTime> dtStartArray,
1628
                                    List<DateTime> dtCompArray, List<int> SalaryArray,
1629
                                    List<DateTime> dtMaxCompArray, List<DateTime> dtHireStDayArray)
1683
        private void SetPayrollData(List<int> PersonCDArray, DateTime dtDefaultStart, DateTime dtDefaultEnd,
1684
                                    List<DateTime> dtStartArray, List<DateTime> dtCompArray,
1685
                                    List<int> SalaryArray, List<DateTime> dtMaxCompArray,
1686
                                    List<DateTime> dtHireStDayArray, List<DateTime> dtHireEdDayArray)
1630 1687
        {
1631 1688
            try
1632 1689
            {
1690
                //Debug.WriteLine("---------------------");
1633 1691
                // ?????R?[?h??
1634 1692
                int DepartmentCode = GetDepartmentCode();
1635 1693

  
1636 1694
                // ??????????E??????????
1637
                DateTime dtDefaultStart = DateTime.MinValue;
1638
                DateTime dtDefaultEnd = DateTime.MinValue;
1639
                CreateDefaultStartAndEndDate(ref dtDefaultStart, ref dtDefaultEnd);
1695
                DateTime dtCurDefaultStart = dtDefaultStart;
1696
                DateTime dtCurDefaultEnd = dtDefaultEnd;
1640 1697

  
1641 1698
                int TotalSalary = 0;        // ???^????
1642 1699
                int OnSalary = 0;           // ?U?????^???z??
......
1651 1708
                // ???^???W?v????
1652 1709
                for (int i = 0; i < PersonCDArray.Count; i++)
1653 1710
                {
1711
                    // ??????????E??????????
1712
                    dtCurDefaultStart = dtDefaultStart;
1713
                    dtCurDefaultEnd = dtDefaultEnd;
1714

  
1715
                    // ???????????????J?n???????????
1716
                    if (dtDefaultStart < dtHireStDayArray[i] && dtHireStDayArray[i] < dtDefaultEnd)
1717
                    {
1718
                        dtCurDefaultStart = dtHireStDayArray[i];
1719
                    }
1720
                    // ??????????????I????????????
1721
                    if (dtDefaultStart < dtHireEdDayArray[i] && dtHireEdDayArray[i] < dtDefaultEnd)
1722
                    {
1723
                        dtCurDefaultEnd = dtHireEdDayArray[i];
1724
                    }
1725
                    
1654 1726
                    // ?J?n????
1655 1727
                    dtStart = dtStartArray[i];
1656 1728
                    // ?f?[?^?????????????????Z?b?g????
1657 1729
                    if (dtStart == DateTime.MaxValue)
1658 1730
                    {
1659
                        if (dtDefaultStart < dtHireStDayArray[i] && dtHireStDayArray[i] < dtDefaultEnd)
1660
                            dtStart = dtHireStDayArray[i];
1661
                        else
1662
                            dtStart = dtDefaultStart;
1731
                        dtStart = dtCurDefaultStart;
1663 1732
                    }
1664
                    else if (dtDefaultStart < dtStart)
1665
                    {   // ?J?n?????????????????O??f?[?^???????????`?F?b?N????
1666
                        dtStart = dtDefaultStart;
1733
                    else if (dtCurDefaultStart < dtStart)
1734
                    {   // ?J?n?????????????????????Z?b?g????
1735
                        dtStart = dtCurDefaultStart;
1667 1736
                    }
1668 1737

  
1669
                    // ?f?[?^?????????????????Z?b?g????
1670
                    if (dtStart == DateTime.MinValue) dtStart = dtDefaultStart;
1671
                    // ?I??????
1672
                    dtEnd = dtCompArray[i];
1673
                    if (dtEnd == DateTime.MinValue) dtEnd = dtDefaultEnd;
1674 1738
                    // ??????
1675 1739
                    dtMax = dtMaxCompArray[i];
1676
                    if (dtMax == DateTime.MinValue) dtMax = dtDefaultEnd;
1740
                    if (dtMax == DateTime.MinValue) dtMax = dtCurDefaultEnd;
1741
                    // ???????????????????
1742
                    if (dtMax < DateTime.Today.Date)
1743
                    {
1744
                        if (numUDConstPro.Value < CommonMotions.SystemMasterData.BusinessPeriod)
1745
                        {   // ?O????O?????
1746
                            dtMax = dtCurDefaultEnd;
1747
                        }
1748
                        else if (dtHireEdDayArray[i] != DateTime.MinValue
1749
                                && (dtDefaultStart < dtHireEdDayArray[i] && dtHireEdDayArray[i] < dtDefaultEnd))
1750
                        {   // ??????????????I????????????
1751
                            dtMax = dtCurDefaultEnd;
1752
                        }
1753
                        else
1754
                        {   // ??O?????
1755
                            dtMax = DateTime.Today.Date;
1756
                        }
1757
                    }
1677 1758

  
1678 1759
                    // ???^????
1679
                    int workSalary = CalcElapsedSalary(dtStart, dtEnd, PersonCDArray[i], SalaryArray[i]);
1760
                    int workSalary = CalcElapsedSalary(dtStart, dtMax, PersonCDArray[i], SalaryArray[i]);
1680 1761
                    // ??v???Z
1681 1762
                    if (workSalary > 0) TotalSalary += workSalary;
1763
                    // Debug.WriteLine(string.Format("Code={0} Val={1} Start={2} End={3}", PersonCDArray[i], workSalary.ToString("0,0"), dtStart, dtMax));
1682 1764

  
1683 1765
                    // ?v?Z?J?n?I????????????
1684 1766
                    if (dtStart < dtDispStart) dtDispStart = dtStart;
1685 1767
                    if (dtDispComplate < dtMax) dtDispComplate = dtMax;
1686 1768
                }
1687 1769

  
1770
                // ----- ?\??????
1688 1771
                // ?U?????^???z?E?????v???z?E?e???v???z??
1689 1772
                ProfitGeneral(DepartmentCode, 0, ref OnSalary, ref  NetIncome, ref  NonSalary);
1690 1773

  
......
1734 1817
        /// <returns></returns>
1735 1818
        private int CalcElapsedSalary(DateTime dtStart, DateTime dtLast, int PersonCode, int Salary)
1736 1819
        {
1820
            IOMPersonSalary SalDB = new IOMPersonSalary();
1737 1821
            try
1738 1822
            {
1739
                // ???????????????
1740
                int WorkingDay = ClsCalendar.CalcPassedDaysCount(dtStart, dtLast);
1823
                int RetSalary = 0;
1741 1824

  
1742
                // ???^??
1743
                int MonthlyPay = CommonMotions.cnvRound(Salary * CommonDefine.s_SalaryCorrection);
1825
                string strSQL = "SELECT AX.hiduke,";
1826
                strSQL += string.Format(" ROUND((AX.salary * {0})/ {1}),", CommonDefine.s_SalaryCorrection, CommonDefine.s_ManHourUnitMonth);
1827
                strSQL += " MAX(AX.StartD) FROM";
1828
                strSQL += " (SELECT A.d hiduke, B.MonthlySalary salary, B.STARTDATE StartD FROM";
1744 1829

  
1745
                // ?????v?Z
1746
                double daylySalary = CommonMotions.cnvRound(MonthlyPay / CommonDefine.s_ManHourUnitMonth);
1830
                strSQL += " (SELECT A1.years, A2.month, A3.days, DATE(CONCAT(A1.years, '/', A2.month, '/', A3.days)) AS d";
1831
                strSQL += " FROM yearmaster AS A1, monthmaster AS A2, daymaster AS A3";
1747 1832

  
1748
                // ?o????^?v?Z
1749
                int RetSalary =CommonMotions.cnvRound(WorkingDay * daylySalary);
1833
                strSQL += " WHERE";
1834
                if (dtStart.Year == dtLast.Year)
1835
                {
1836
                    strSQL += string.Format(" (A1.years = {0} AND A2.month IN(", dtStart.Year.ToString("0000"));
1837
                    for (int i = dtStart.Month; i <= dtLast.Month; i++)
1838
                    {
1839
                        if (i != dtStart.Month) strSQL += ", ";
1840
                        strSQL += string.Format("{0} ", i);
1841
                    }
1842
                    strSQL += "))";
1843
                }
1844
                else
1845
                {
1846
                    strSQL += string.Format(" ((A1.years = {0} AND A2.month IN(", dtStart.Year.ToString("0000"));
1847
                    for (int i = dtStart.Month; i <= 12; i++)
1848
                    {
1849
                        if (i != dtStart.Month) strSQL += ", ";
1850
                        strSQL += string.Format("{0} ", i);
1851
                    }
1852
                    strSQL += "))";
1853
                    strSQL += string.Format(" OR (A1.years = {0} AND A2.month IN(", dtLast.Year.ToString("0000"));
1854
                    for (int i = 1; i <= dtLast.Month; i++)
1855
                    {
1856
                        if (i != 1) strSQL += ", ";
1857
                        strSQL += string.Format("{0} ", i);
1858
                    }
1859
                    strSQL += ")))";
1860
                }
1750 1861

  
1862
                strSQL += " AND DATE(CONCAT(A1.years, '/', A2.month, '/', A3.days)) IS NOT NULL";
1863
                strSQL += " ORDER BY d) A";
1864
                strSQL += ", PERSONSALARYMASTER AS B";
1865
                strSQL += " WHERE B.STARTDATE <= A.d";
1866
                strSQL += string.Format(" AND B.PERSONCODE = {0}", PersonCode);
1867
                strSQL += " ORDER BY A.d, B.STARTDATE DESC) AS AX";
1868
                strSQL += " GROUP BY AX.hiduke";
1869
                strSQL += " ORDER BY AX.hiduke";
1870

  
1871
                ArrayList ArData = new ArrayList();
1872
                SalDB.ExecuteReader(strSQL, ref ArData);
1873

  
1874
                foreach (object[] objRec in ArData)
1875
                {
1876
                    RetSalary += CommonMotions.cnvInt(objRec[1]);
1877
                }
1878

  
1751 1879
                return RetSalary;
1752 1880
            }
1753 1881
            catch (Exception ex)
......
1755 1883
                logger.ErrorFormat("?V?X?e???G???[?F{0}?F{1}", CommonMotions.GetMethodName(), ex.Message);
1756 1884
                return 0;
1757 1885
            }
1886
            finally
1887
            {
1888
                SalDB.close(); SalDB = null;
1889
            }
1758 1890
        }
1759 1891
        #endregion
1760 1892

  
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/EstimateInput/FrmEstimateInputAuxiliary.cs
4523 4523
                    DetailRec.ConstructionCode = LargeList[iy].ConstructionCode;
4524 4524
                    DetailRec.ComponentCode = LargeList[iy].ComponentCode;
4525 4525
                    DetailRec.ItemName = LargeList[iy].ItemName;
4526
                    DetailRec.SpecName = LargeList[iy].SpecName;
4526 4527
                    DetailRec.UnitCount = 1.0;
4527 4528
                    DetailRec.UnitName = "式";
4528 4529
                    DetailRec.LineTotal = LargeList[iy].PriceValue;

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