プロジェクト

全般

プロフィール

リビジョン 112

堀内7年以上前に追加

台帳まとめ画面、給与計算日不具合対応・給与計算方法守勢

差分を表示:

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

  
19 19
        /// <summary>
20 20
        /// コピー・環境バージョン
trunk/src/ProcessManagement/ProcessManagement/Common/Process/ClsExcute.cs
1773 1773
            FrmCostomerRegistList frm = new FrmCostomerRegistList();
1774 1774
            try
1775 1775
            {
1776
                // 起動・編集フラグ
1777
                int ProcessNo = (int)ClsExcute.ProcessExecuteNo.CostomerRegist;
1778
                int EditFlg = (int)CommonDefine.ProcessDataEdit.Reference;
1779
                if (!ClsSecurityPermission.GetExecutePermission(ProcessNo, ref EditFlg))
1780
                {
1781
                    BackProcess();
1782
                    return;
1783
                }
1776 1784
                // フォーム表示
1777 1785
                frm.ShowDialog();
1778 1786
            }
......
1788 1796
        }
1789 1797
        #endregion
1790 1798

  
1791
        #region 発注者登録申請一覧
1799
        #region 発注者登録申請入力
1792 1800
        /// <summary>
1793
        /// 発注者登録申請一覧
1801
        /// 発注者登録申請入力
1794 1802
        /// </summary>
1795 1803
        /// <param name="CurrentPara"></param>
1796 1804
        public static void ProcessExecuteNo_CostomerRegist(ProcessParameter CurrentPara)
......
1844 1852
            FrmSubConstrRegistList frm = new FrmSubConstrRegistList();
1845 1853
            try
1846 1854
            {
1855
                // 起動・編集フラグ
1856
                int ProcessNo = (int)ClsExcute.ProcessExecuteNo.SubConstrRegist;
1857
                int EditFlg = (int)CommonDefine.ProcessDataEdit.Reference;
1858
                if (!ClsSecurityPermission.GetExecutePermission(ProcessNo, ref EditFlg))
1859
                {
1860
                    BackProcess();
1861
                    return;
1862
                }
1847 1863
                // フォーム表示
1848 1864
                frm.ShowDialog();
1849 1865
            }
......
1859 1875
        }
1860 1876
        #endregion
1861 1877

  
1862
        #region 協力会社登録申請一覧
1878
        #region 協力会社登録申請入力
1863 1879
        /// <summary>
1864
        /// 協力会社登録申請一覧
1880
        /// 協力会社登録申請入力
1865 1881
        /// </summary>
1866 1882
        /// <param name="CurrentPara"></param>
1867 1883
        public static void ProcessExecuteNo_SubConstrRegist(ProcessParameter CurrentPara)
......
1871 1887
            try
1872 1888
            {
1873 1889
                // 自分のハンドルをリストへセットする
1874
                int ProcessNo = (int)ClsExcute.ProcessExecuteNo.CostomerRegist;
1890
                int ProcessNo = (int)ClsExcute.ProcessExecuteNo.SubConstrRegist;
1875 1891
                ClsExcute.SubFormHandleList[ProcessNo].ProcessNo = ProcessNo;
1876 1892
                ClsExcute.SubFormHandleList[ProcessNo].SubFormHandle = (Form)frm;
1877 1893

  
trunk/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
            {
......
915 911
            /// ??p?J?n???t
916 912
            /// </summary>
917 913
            HireStartDays,
914
            /// <summary>
915
            /// ??p?I?????t
916
            /// </summary>
917
            HireCompDays,
918 918
        }
919 919
        #endregion
920 920

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

  
951 951
                // ?H???S?????f?[?^??
......
995 995

  
996 996
                strSQL += " GROUP BY A.DEPARTMENTCODE, A.DEPARTMENTSTRING, A.DISPLAYORDER))";
997 997

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

  
1010
                strSQL += " GROUP BY P.PERSONCODE, P.PERSONNAME, P.DISPLAYORDER, P.MonthlySalary, P.STARTDATE";
1002
                strSQL += " GROUP BY P.PERSONCODE, P.PERSONNAME, P.DISPLAYORDER, P.MonthlySalary, P.STARTDATE, P.ENDDATE";
1011 1003
                strSQL += " ORDER BY P.DISPLAYORDER";
1012 1004

  
1013 1005
                ArrayList arList = new ArrayList();
......
1050 1042
                    // ???z???^????????
1051 1043
                    int Salary = CommonMotions.cnvInt(objRec[(int)GetPersonTerm.MonthlySalary]);
1052 1044

  
1053
                    // ??p?J?n??????????
1054
                    DateTime dtHireDay = CommonMotions.cnvDate(objRec[(int)GetPersonTerm.HireStartDays]);
1045
                    // ??p?J?n?E?I????????????
1046
                    DateTime dtHireStDay = CommonMotions.cnvDate(objRec[(int)GetPersonTerm.HireStartDays]);
1047
                    DateTime dtHireEdDay = CommonMotions.cnvDate(objRec[(int)GetPersonTerm.HireCompDays]);
1055 1048

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

  
1520 1518
                // ProgressBar??l???X????
1521 1519
                prgber.Value++;
1522 1520
                prgber.Update();
1523 1521

  
1522
                // ?f?t?H???g?J?n?E?I??????????
1523
                DateTime dtDefaultStart = DateTime.MinValue;
1524
                DateTime dtDefaultEnd = DateTime.MinValue;
1525
                CreateDefaultStartAndEndDate(ref dtDefaultStart, ref dtDefaultEnd);
1526

  
1524 1527
                // ----- ?o????^?\???i?w?b?_?[??\???j
1525
                SetPayrollData(PersonCDArray, dtStartArray, dtCompArray, SalaryArray, dtMaxCompArray, dtHireStDays);
1528
                SetPayrollData(PersonCDArray, dtDefaultStart, dtDefaultEnd,
1529
                                dtStartArray, dtCompArray,
1530
                                SalaryArray, dtMaxCompArray,
1531
                                dtHireStDays, dtHireEdDays);
1526 1532

  
1527 1533
                // ----- ?o???\??????
1528 1534
                int Expenses = SetOtherCost(PersonCDArray, dtStartArray, dtCompArray);
......
1902 1908
        /// <param name="dtStartArray"></param>
1903 1909
        /// <param name="dtCompArray"></param>
1904 1910
        /// <param name="SalaryArray"></param>
1905
        private void SetPayrollData(List<int> PersonCDArray, List<DateTime> dtStartArray,
1906
                                    List<DateTime> dtCompArray, List<int> SalaryArray,
1907
                                    List<DateTime> dtMaxCompArray, List<DateTime> dtHireStDayArray)
1911
        private void SetPayrollData(List<int> PersonCDArray, DateTime dtDefaultStart, DateTime dtDefaultEnd,
1912
                                    List<DateTime> dtStartArray, List<DateTime> dtCompArray,
1913
                                    List<int> SalaryArray, List<DateTime> dtMaxCompArray,
1914
                                    List<DateTime> dtHireStDayArray, List<DateTime> dtHireEdDayArray)
1908 1915
        {
1909 1916
            try
1910 1917
            {
1918
                //Debug.WriteLine("---------------------");
1911 1919
                // ?????R?[?h??
1912 1920
                int DepartmentCode = GetDepartmentCode();
1913 1921

  
1914 1922
                // ??????????E??????????
1915
                DateTime dtDefaultStart = DateTime.MinValue;
1916
                DateTime dtDefaultEnd = DateTime.MinValue;
1917
                CreateDefaultStartAndEndDate(ref dtDefaultStart, ref dtDefaultEnd);
1923
                DateTime dtCurDefaultStart = dtDefaultStart;
1924
                DateTime dtCurDefaultEnd = dtDefaultEnd;
1918 1925

  
1919 1926
                int TotalSalary = 0;        // ???^????
1920 1927
                int OnSalary = 0;           // ?U?????^???z??
......
1929 1936
                // ???^???W?v????
1930 1937
                for (int i = 0; i < PersonCDArray.Count; i++)
1931 1938
                {
1939
                    // ??????????E??????????
1940
                    dtCurDefaultStart = dtDefaultStart;
1941
                    dtCurDefaultEnd = dtDefaultEnd;
1942

  
1943
                    // ???????????????J?n???????????
1944
                    if (dtDefaultStart < dtHireStDayArray[i] && dtHireStDayArray[i] < dtDefaultEnd)
1945
                    {
1946
                        dtCurDefaultStart = dtHireStDayArray[i];
1947
                    }
1948
                    // ??????????????I????????????
1949
                    if (dtDefaultStart < dtHireEdDayArray[i] && dtHireEdDayArray[i] < dtDefaultEnd)
1950
                    {
1951
                        dtCurDefaultEnd = dtHireEdDayArray[i];
1952
                    }
1953

  
1932 1954
                    // ?J?n????
1933 1955
                    dtStart = dtStartArray[i];
1934 1956
                    // ?f?[?^?????????????????Z?b?g????
1935 1957
                    if (dtStart == DateTime.MaxValue)
1936 1958
                    {
1937
                        if (dtDefaultStart < dtHireStDayArray[i] && dtHireStDayArray[i] < dtDefaultEnd)
1938
                            dtStart = dtHireStDayArray[i];
1939
                        else
1940
                            dtStart = dtDefaultStart;
1959
                        dtStart = dtCurDefaultStart;
1941 1960
                    }
1942
                    // ?I??????
1943
                    dtEnd = dtCompArray[i];
1944
                    if (dtEnd == DateTime.MinValue) dtEnd = dtDefaultEnd;
1961
                    else if (dtCurDefaultStart < dtStart)
1962
                    {   // ?J?n?????????????????????Z?b?g????
1963
                        dtStart = dtCurDefaultStart;
1964
                    }
1965

  
1945 1966
                    // ??????
1946 1967
                    dtMax = dtMaxCompArray[i];
1947
                    if (dtMax == DateTime.MinValue) dtMax = dtDefaultEnd;
1968
                    if (dtMax == DateTime.MinValue) dtMax = dtCurDefaultEnd;
1969
                    // ???????????????????
1970
                    if (dtMax < DateTime.Today.Date)
1971
                    {
1972
                        if (numUDConstPro.Value < CommonMotions.SystemMasterData.BusinessPeriod)
1973
                        {   // ?O????O?????
1974
                            dtMax = dtCurDefaultEnd;
1975
                        }
1976
                        else if (dtHireEdDayArray[i] != DateTime.MinValue && dtDefaultStart < dtHireEdDayArray[i] && dtHireEdDayArray[i] < dtDefaultEnd)
1977
                        {   // ??????????????I????????????
1978
                            dtMax = dtCurDefaultEnd;
1979
                        }
1980
                        else
1981
                        {   // ??O?????
1982
                            dtMax = DateTime.Today.Date;
1983
                        }
1984
                    }
1948 1985

  
1949 1986
                    // ???^????
1950
                    int workSalary = CalcElapsedSalary(dtStart, dtEnd, PersonCDArray[i], SalaryArray[i]);
1987
                    int workSalary = CalcElapsedSalary(dtStart, dtMax, PersonCDArray[i], SalaryArray[i]);
1951 1988
                    // ??v???Z
1952 1989
                    if (workSalary > 0) TotalSalary += workSalary;
1990
                    //Debug.WriteLine(string.Format("Code={0} Val={1} Start={2} End={3}", PersonCDArray[i], workSalary.ToString("0,0"), dtStart, dtMax));
1953 1991

  
1954 1992
                    // ?v?Z?J?n?I????????????
1955 1993
                    if (dtStart < dtDispStart) dtDispStart = dtStart;
1956 1994
                    if (dtDispComplate < dtMax) dtDispComplate = dtMax;
1957 1995
                }
1958 1996

  
1997
                // ----- ?\??????
1959 1998
                // ?U?????^???z?E?????v???z?E?e???v???z??
1960 1999
                ProfitGeneral(ref OnSalary, ref  NetIncome, ref  NonSalary);
1961 2000

  
......
2005 2044
        /// <returns></returns>
2006 2045
        private int CalcElapsedSalary(DateTime dtStart, DateTime dtLast, int PersonCode, int Salary)
2007 2046
        {
2047
            IOMPersonSalary SalDB = new IOMPersonSalary();
2008 2048
            try
2009 2049
            {
2010
                // ???????????????
2011
                int WorkingDay = ClsCalendar.CalcPassedDaysCount(dtStart, dtLast);
2050
                //// ???????????????
2051
                //int WorkingDay = ClsCalendar.CalcPassedDaysCount(dtStart, dtLast);
2012 2052

  
2013
                // ???^??
2014
                int MonthlyPay = CommonMotions.cnvRound(Salary * CommonDefine.s_SalaryCorrection);
2053
                //// ???^??
2054
                //int MonthlyPay = CommonMotions.cnvRound(Salary * CommonDefine.s_SalaryCorrection);
2015 2055

  
2016
                // ?????v?Z
2017
                double daylySalary = CommonMotions.cnvRound(MonthlyPay / CommonDefine.s_ManHourUnitMonth);
2056
                //// ?????v?Z
2057
                //double daylySalary = CommonMotions.cnvRound(MonthlyPay / CommonDefine.s_ManHourUnitMonth);
2018 2058

  
2019
                // ?o????^?v?Z
2020
                int RetSalary = CommonMotions.cnvRound(WorkingDay * daylySalary);
2059
                //// ?o????^?v?Z
2060
                //int RetSalary = CommonMotions.cnvRound(WorkingDay * daylySalary);
2061
                int RetSalary = 0;
2021 2062

  
2063
                string strSQL = "SELECT * FROM";
2064
                strSQL += " (SELECT AX.DT,";
2065
                strSQL += string.Format(" ROUND((A.MONTHLYSALARY * {0})/ {1}),", CommonDefine.s_SalaryCorrection, CommonDefine.s_ManHourUnitMonth);
2066
                strSQL += " row_number() OVER(PARTITION BY AX.DT ORDER BY A.STARTDATE DESC) row_num";
2067
                strSQL += " FROM PERSONSALARYMASTER A,";
2068
                strSQL += " (SELECT TO_CHAR((st + ROWNUM - 1), 'YYYY/MM/DD') DT";
2069
                strSQL += string.Format(" FROM SYS.ALL_CATALOG A, (SELECT TO_DATE('{0}{1}{2}', 'yyyymmdd') st,", dtStart.Year.ToString("0000"), dtStart.Month.ToString("00"), dtStart.Day.ToString("00"));
2070
                strSQL += string.Format(" TO_DATE('{0}{1}{2}', 'yyyymmdd') ed", dtLast.Year.ToString("0000"), dtLast.Month.ToString("00"), dtLast.Day.ToString("00"));
2071
                strSQL += " FROM SYS.DUAL) B WHERE ROWNUM <= (ed - st + 1)) AX";
2072
                strSQL += string.Format(" WHERE A.PERSONCODE = {0}", PersonCode);
2073
                strSQL += " AND A.STARTDATE <= AX.DT) B WHERE row_num = 1";
2074

  
2075
                ArrayList ArData = new ArrayList();
2076
                SalDB.ExecuteReader(strSQL, ref ArData);
2077

  
2078
                foreach (object[] objRec in ArData)
2079
                {
2080
                    RetSalary += CommonMotions.cnvInt(objRec[1]);
2081
                }
2082

  
2022 2083
                return RetSalary;
2023 2084
            }
2024 2085
            catch (Exception ex)
......
2026 2087
                logger.ErrorFormat("?V?X?e???G???[?F{0}?F{1}", CommonMotions.GetMethodName(), ex.Message);
2027 2088
                return 0;
2028 2089
            }
2090
            finally
2091
            {
2092
                SalDB.close(); SalDB = null;
2093
            }
2029 2094
        }
2030 2095
        #endregion
2031 2096

  
trunk/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))";
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
            }
......
1342 1339
                List<DateTime> dtMaxCompArray = new List<DateTime>();
1343 1340
                List<int> SalaryArray = new List<int>();
1344 1341
                List<DateTime> dtHireStDayArray = new List<DateTime>();
1345
                GetPersonInDepartment(ref DepInPerArray, ref PersonCDArray, ref dtStartArray, ref dtCompArray, ref dtMaxCompArray, ref SalaryArray, ref dtHireStDayArray);
1342
                List<DateTime> dtHireEdDayArray = new List<DateTime>();
1343
                GetPersonInDepartment(ref DepInPerArray, ref PersonCDArray,
1344
                                        ref dtStartArray, ref dtCompArray,
1345
                                        ref dtMaxCompArray, ref SalaryArray,
1346
                                        ref dtHireStDayArray, ref dtHireEdDayArray);
1346 1347

  
1347 1348
                // ProgressBar??l???X????
1348 1349
                prgber.Value++;
......
1353 1354
                DateTime dtDefaultEnd = DateTime.MinValue;
1354 1355
                CreateDefaultStartAndEndDate(ref dtDefaultStart, ref dtDefaultEnd);
1355 1356

  
1356

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

  
1360 1363
                // ProgressBar??l???X????
1361 1364
                prgber.Value++;
......
1536 1539
                strSQL += " ,SUM(A.GROSSPROFIT)";
1537 1540
                strSQL += " ,SUM(A.NETPROFIT)";
1538 1541

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

  
1547 1542
                strSQL += " FROM PERSONINCHARGEMASTER C";
1548 1543
                strSQL += " LEFT JOIN CONSTRUCTIONBASEINFO B ON B.CONSTRUCTIONPERSONCODE = C.PERSONCODE";
1549 1544
                strSQL += string.Format(" AND B.CONSTRUCTIONPERIOD = {0}", numUDConstPro.Value);
......
1553 1548
                strSQL += " DEPARTMENTMASTER D";
1554 1549
                strSQL += " WHERE B.CONSTRUCTIONPERSONCODE = C.PERSONCODE";
1555 1550
                strSQL += " AND C.DEPARTMENTCODE = D.DEPARTMENTCODE";
1551
                strSQL += " AND C.DELETEFLG = 0";
1556 1552

  
1557 1553
                strSQL += " GROUP BY  C.DEPARTMENTCODE, D.DEPARTMENTSTRING, D.DISPLAYORDER";
1558 1554
                strSQL += " ORDER BY 3 ASC";
......
1618 1614
        /// <summary>
1619 1615
        /// ??????o????^??\??????
1620 1616
        /// </summary>
1621
        /// <param name="PersonCDArray"></param>
1622
        /// <param name="dtStartArray"></param>
1623
        /// <param name="dtCompArray"></param>
1624
        /// <param name="SalaryArray"></param>
1625
        private void SetPayrollData(List<int> PersonCDArray, List<DateTime> dtStartArray,
1626
                                    List<DateTime> dtCompArray, List<int> SalaryArray,
1627
                                    List<DateTime> dtMaxCompArray, List<DateTime> dtHireStDayArray)
1617
        private void SetPayrollData(List<int> PersonCDArray, DateTime dtDefaultStart, DateTime dtDefaultEnd,
1618
                                    List<DateTime> dtStartArray, List<DateTime> dtCompArray,
1619
                                    List<int> SalaryArray, List<DateTime> dtMaxCompArray,
1620
                                    List<DateTime> dtHireStDayArray, List<DateTime> dtHireEdDayArray)
1628 1621
        {
1629 1622
            try
1630 1623
            {
1624
                //Debug.WriteLine("---------------------");
1631 1625
                // ?????R?[?h??
1632 1626
                int DepartmentCode = GetDepartmentCode();
1633 1627

  
1634 1628
                // ??????????E??????????
1635
                DateTime dtDefaultStart = DateTime.MinValue;
1636
                DateTime dtDefaultEnd = DateTime.MinValue;
1637
                CreateDefaultStartAndEndDate(ref dtDefaultStart, ref dtDefaultEnd);
1629
                DateTime dtCurDefaultStart = dtDefaultStart;
1630
                DateTime dtCurDefaultEnd = dtDefaultEnd;
1638 1631

  
1639 1632
                int TotalSalary = 0;        // ???^????
1640 1633
                int OnSalary = 0;           // ?U?????^???z??
......
1649 1642
                // ???^???W?v????
1650 1643
                for (int i = 0; i < PersonCDArray.Count; i++)
1651 1644
                {
1645
                    // ??????????E??????????
1646
                    dtCurDefaultStart = dtDefaultStart;
1647
                    dtCurDefaultEnd = dtDefaultEnd;
1648

  
1649
                    // ???????????????J?n???????????
1650
                    if (dtDefaultStart < dtHireStDayArray[i] && dtHireStDayArray[i] < dtDefaultEnd)
1651
                    {
1652
                        dtCurDefaultStart = dtHireStDayArray[i];
1653
                    }
1654
                    // ??????????????I????????????
1655
                    if (dtDefaultStart < dtHireEdDayArray[i] && dtHireEdDayArray[i] < dtDefaultEnd)
1656
                    {
1657
                        dtCurDefaultEnd = dtHireEdDayArray[i];
1658
                    }
1659
                    
1652 1660
                    // ?J?n????
1653 1661
                    dtStart = dtStartArray[i];
1654 1662
                    // ?f?[?^?????????????????Z?b?g????
1655 1663
                    if (dtStart == DateTime.MaxValue)
1656 1664
                    {
1657
                        if (dtDefaultStart < dtHireStDayArray[i] && dtHireStDayArray[i] < dtDefaultEnd)
1658
                            dtStart = dtHireStDayArray[i];
1659
                        else
1660
                            dtStart = dtDefaultStart;
1665
                        dtStart = dtCurDefaultStart;
1661 1666
                    }
1662
                    // ?f?[?^?????????????????Z?b?g????
1663
                    if (dtStart == DateTime.MinValue) dtStart = dtDefaultStart;
1664
                    // ?I??????
1665
                    dtEnd = dtCompArray[i];
1666
                    if (dtEnd == DateTime.MinValue) dtEnd = dtDefaultEnd;
1667
                    else if (dtCurDefaultStart < dtStart)
1668
                    {   // ?J?n?????????????????????Z?b?g????
1669
                        dtStart = dtCurDefaultStart;
1670
                    }
1671

  
1667 1672
                    // ??????
1668 1673
                    dtMax = dtMaxCompArray[i];
1669
                    if (dtMax == DateTime.MinValue) dtMax = dtDefaultEnd;
1674
                    if (dtMax == DateTime.MinValue) dtMax = dtCurDefaultEnd;
1675
                    // ???????????????????
1676
                    if (dtMax < DateTime.Today.Date)
1677
                    {
1678
                        if (numUDConstPro.Value < CommonMotions.SystemMasterData.BusinessPeriod)
1679
                        {   // ?O????O?????
1680
                            dtMax = dtCurDefaultEnd;
1681
                        }
1682
                        else if (dtHireEdDayArray[i] != DateTime.MinValue
1683
                                && (dtDefaultStart < dtHireEdDayArray[i] && dtHireEdDayArray[i] < dtDefaultEnd))
1684
                        {   // ??????????????I????????????
1685
                            dtMax = dtCurDefaultEnd;
1686
                        }
1687
                        else
1688
                        {   // ??O?????
1689
                            dtMax = DateTime.Today.Date;
1690
                        }
1691
                    }
1670 1692

  
1671 1693
                    // ???^????
1672
                    int workSalary = CalcElapsedSalary(dtStart, dtEnd, PersonCDArray[i], SalaryArray[i]);
1694
                    int workSalary = CalcElapsedSalary(dtStart, dtMax, PersonCDArray[i], SalaryArray[i]);
1673 1695
                    // ??v???Z
1674 1696
                    if (workSalary > 0) TotalSalary += workSalary;
1697
                    Debug.WriteLine(string.Format("Code={0} Val={1} Start={2} End={3}", PersonCDArray[i], workSalary.ToString("0,0"), dtStart, dtMax));
1675 1698

  
1676 1699
                    // ?v?Z?J?n?I????????????
1677 1700
                    if (dtStart < dtDispStart) dtDispStart = dtStart;
1678 1701
                    if (dtDispComplate < dtMax) dtDispComplate = dtMax;
1679 1702
                }
1680 1703

  
1704
                // ----- ?\??????
1681 1705
                // ?U?????^???z?E?????v???z?E?e???v???z??
1682 1706
                ProfitGeneral(DepartmentCode, 0, ref OnSalary, ref  NetIncome, ref  NonSalary);
1683 1707

  
......
1727 1751
        /// <returns></returns>
1728 1752
        private int CalcElapsedSalary(DateTime dtStart, DateTime dtLast, int PersonCode, int Salary)
1729 1753
        {
1754
            IOMPersonSalary SalDB = new IOMPersonSalary();
1730 1755
            try
1731 1756
            {
1732
                // ???????????????
1733
                int WorkingDay = ClsCalendar.CalcPassedDaysCount(dtStart, dtLast);
1757
                //// ???????????????
1758
                //int WorkingDay = ClsCalendar.CalcPassedDaysCount(dtStart, dtLast);
1734 1759

  
1735
                // ???^??
1736
                int MonthlyPay = CommonMotions.cnvRound(Salary * CommonDefine.s_SalaryCorrection);
1760
                //// ???^??
1761
                //int MonthlyPay = CommonMotions.cnvRound(Salary * CommonDefine.s_SalaryCorrection);
1737 1762

  
1738
                // ?????v?Z
1739
                double daylySalary = CommonMotions.cnvRound(MonthlyPay / CommonDefine.s_ManHourUnitMonth);
1763
                //// ?????v?Z
1764
                //double daylySalary = CommonMotions.cnvRound(MonthlyPay / CommonDefine.s_ManHourUnitMonth);
1740 1765

  
1741
                // ?o????^?v?Z
1742
                int RetSalary =CommonMotions.cnvRound(WorkingDay * daylySalary);
1766
                //// ?o????^?v?Z
1767
                //int RetSalary =CommonMotions.cnvRound(WorkingDay * daylySalary);
1768
                int RetSalary = 0;
1743 1769

  
1770
                string strSQL = "SELECT * FROM";
1771
                strSQL += " (SELECT AX.DT,";
1772
                strSQL += string.Format(" ROUND((A.MONTHLYSALARY * {0})/ {1}),", CommonDefine.s_SalaryCorrection, CommonDefine.s_ManHourUnitMonth);
1773
                strSQL += " row_number() OVER(PARTITION BY AX.DT ORDER BY A.STARTDATE DESC) row_num";
1774
                strSQL += " FROM PERSONSALARYMASTER A,";
1775
                strSQL += " (SELECT TO_CHAR((st + ROWNUM - 1), 'YYYY/MM/DD') DT";
1776
                strSQL += string.Format(" FROM SYS.ALL_CATALOG A, (SELECT TO_DATE('{0}{1}{2}', 'yyyymmdd') st,", dtStart.Year.ToString("0000"), dtStart.Month.ToString("00"), dtStart.Day.ToString("00"));
1777
                strSQL += string.Format(" TO_DATE('{0}{1}{2}', 'yyyymmdd') ed", dtLast.Year.ToString("0000"), dtLast.Month.ToString("00"), dtLast.Day.ToString("00"));
1778
                strSQL += " FROM SYS.DUAL) B WHERE ROWNUM <= (ed - st + 1)) AX";
1779
                strSQL += string.Format(" WHERE A.PERSONCODE = {0}", PersonCode);
1780
                strSQL += " AND A.STARTDATE <= AX.DT) B WHERE row_num = 1";
1781

  
1782
                ArrayList ArData = new ArrayList();
1783
                SalDB.ExecuteReader(strSQL, ref ArData);
1784

  
1785
                foreach (object[] objRec in ArData)
1786
                {
1787
                    RetSalary += CommonMotions.cnvInt(objRec[1]);
1788
                }
1789

  
1744 1790
                return RetSalary;
1745 1791
            }
1746 1792
            catch (Exception ex)
......
1748 1794
                logger.ErrorFormat("?V?X?e???G???[?F{0}?F{1}", CommonMotions.GetMethodName(), ex.Message);
1749 1795
                return 0;
1750 1796
            }
1797
            finally
1798
            {
1799
                SalDB.close(); SalDB = null;
1800
            }
1751 1801
        }
1752 1802
        #endregion
1753 1803

  
trunk/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].WorkName;
4526 4527
                    DetailRec.UnitCount = 1.0;
4527 4528
                    DetailRec.UnitName = "式";
4528 4529
                    DetailRec.LineTotal = LargeList[iy].PriceValue;
trunk/src/ProcessManagement/ProcessManagement/Forms/SubForms/FrmPriceOfBudget.cs
91 91
        /// <summary>
92 92
        /// 合計行タイトル
93 93
        /// </summary>
94
        private static string[] s_TotalTitleArray = new string[] {  "*台帳未作成分合計*",
95
                                                                    "*施工中台帳分合計*",
96
                                                                    "*完了工事台帳分合計*",
97
                                                                    "** 総 合 計 **",
94
        private static string[] s_TotalTitleArray = new string[] {  "*台帳 未作成分  合計*",
95
                                                                    "*台帳 作成済  合計*",
96
                                                                    "*台帳 完了済  合計*",
97
                                                                    "**  総  合  計  **",
98 98
                                                                };
99 99
        #endregion
100 100
        #endregion
......
426 426
        {
427 427
            IOConstructionBaseInfo BaseDB = new IOConstructionBaseInfo();
428 428
            DataGridView dgv = dgvMain;
429

  
430
            // 合計エリア初期化
431
            int TotalColCnt = Enum.GetNames(typeof(GridColumn)).Length;
432
            int[] CurTotalArea = new int[TotalColCnt];
433
            Array.Clear(CurTotalArea, 0, CurTotalArea.Length);
429 434
            try
430 435
            {
431 436
                int SelectPeriod = (int)numUDConstPro.Value;
......
468 473
                if (!BaseDB.ExecuteReader(strSQL, ref DatArList)) return;
469 474
                if (DatArList.Count == 0) return;
470 475

  
471
                // 合計エリア初期化
472
                int TotalColCnt = Enum.GetNames(typeof(GridColumn)).Length;
473
                int[] CurTotalArea = new int[TotalColCnt];
474
                Array.Clear(CurTotalArea, 0, CurTotalArea.Length);
475

  
476 476
                int ino = 1;
477 477
                bool FirstFlg = true;
478 478
                string BreakKey = string.Empty;
......
509 509
                    CurTotalArea[(int)GridColumn.SaleseExpeses] += (int)(OrdersDecisionPrice * ExpensesRatio3);        // 営業経費
510 510
                }
511 511

  
512
                // 合計行表示
513
                DisplayTotalRow((int)RowTitleNum.DataType1, CurTotalArea, false);
514

  
515 512
                m_TotalArea[(int)GridColumn.OrdersPrice] += CurTotalArea[(int)GridColumn.OrdersPrice];
516 513
                m_TotalArea[(int)GridColumn.CompanyExpeses] += CurTotalArea[(int)GridColumn.CompanyExpeses];
517 514
                m_TotalArea[(int)GridColumn.DepartmentExpeses] += CurTotalArea[(int)GridColumn.DepartmentExpeses];
......
524 521
            finally
525 522
            {
526 523
                BaseDB.close(); BaseDB = null;
524

  
525
                // 合計行表示
526
                DisplayTotalRow((int)RowTitleNum.DataType1, CurTotalArea, false);
527 527
            }
528 528
        }
529 529
        #endregion
......
566 566
                int[] CurTotalArea = new int[TotalColCnt];
567 567
                Array.Clear(CurTotalArea, 0, CurTotalArea.Length);
568 568

  
569
                bool FirstFlg = true;
569
                int CompFlg = -1;
570 570
                int BreakKey = -1;
571
                int ino = 1;
572 571
                foreach (object[] objGetArry in DatArList)
573 572
                {
574
                    int CompFlg = CommonMotions.cnvInt(objGetArry[0]);
573
                    CompFlg = CommonMotions.cnvInt(objGetArry[0]);
575 574
                    if (BreakKey != CompFlg)
576 575
                    {
577
                        if (!FirstFlg)
578
                        {
579
                            // 合計表示(施工中だけ表示)
580
                            if (CompFlg == 0) DisplayTotalRow((int)RowTitleNum.DataType2, CurTotalArea);
581
                        }
582 576
                        Array.Clear(CurTotalArea, 0, CurTotalArea.Length);
583 577
                        BreakKey = CompFlg;
584
                        FirstFlg = false;
585 578
                    }
586 579

  
587 580
                    int OrdersDecisionPrice = CommonMotions.cnvInt(objGetArry[1]);      // 受注金額
......
600 593
                    m_TotalArea[(int)GridColumn.SaleseExpeses] += CurTotalArea[(int)GridColumn.SaleseExpeses];
601 594

  
602 595
                    // 合計行表示
603
                    DisplayTotalRow(ino++, CurTotalArea);
596
                    DisplayTotalRow((CompFlg + 1), CurTotalArea);
604 597
                }
598
                // データが無い場合は足りない合計を表示する
599
                int ArrayCount = Enum.GetNames(typeof(CommonDefine.ComplateTitleNo)).Length;
600
                if (DatArList.Count < ArrayCount)
601
                {
602
                    Array.Clear(CurTotalArea, 0, CurTotalArea.Length);
603
                    switch (CompFlg)
604
                    {
605
                        case (int)CommonDefine.ComplateTitleNo.Operateing:
606
                            DisplayTotalRow((int)RowTitleNum.DataType3, CurTotalArea);
607
                            break;
608
                        case (int)CommonDefine.ComplateTitleNo.Complated:
609
                            InsertZeroTotalRow((int)RowTitleNum.DataType2, CurTotalArea);
610
                            break;
611
                    }
612
                }
605 613
            }
606 614
            catch (System.Exception ex)
607 615
            {
......
645 653
        }
646 654
        #endregion
647 655

  
656
        #region 0の合計を表示
657
        /// <summary>
658
        /// 0の合計を表示する
659
        /// </summary>
660
        private void InsertZeroTotalRow(int TitleNo, int[] TotalArea)
661
        {
662
            try
663
            {
664
                DataGridView dgv = dgvMain;
665
                int LastRowCnt = dgv.RowCount;
666

  
667
                dgv.Rows.Insert((LastRowCnt - 2), 2);
668
                int EditRowCnt = dgv.RowCount - 3;
669

  
670
                // 合計行表示
671
                dgv.Rows[EditRowCnt].Cells[(int)GridColumn.ConstrName].Value = s_TotalTitleArray[TitleNo];
672
                dgv.Rows[EditRowCnt].Cells[(int)GridColumn.ConstrName].Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
673
                // 行の色を変える
674
                SetRowColor(dgv.Rows[EditRowCnt], s_RowTotalBackColor, s_RowTotalForeColor);
675

  
676
                // 数値表示
677
                for (int i = (int)GridColumn.OrdersPrice; i <= (int)GridColumn.SaleseExpeses; i++)
678
                {
679
                    dgv.Rows[EditRowCnt].Cells[i].Value = TotalArea[i].ToString("#,0");
680
                }
681
            }
682
            catch (System.Exception ex)
683
            {
684
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
685
            }
686
        }
687
        #endregion
688

  
648 689
        #region 行色設定
649 690
        /// <summary>
650 691
        /// 行を選択色にする
trunk/src/ProcessManagement/ProcessManagement/Properties/AssemblyInfo.cs
33 33
// 既定値にすることができます:
34 34
// [assembly: AssemblyVersion("1.0.*")]
35 35
[assembly: AssemblyVersion("0.0.0.0")]
36
[assembly: AssemblyFileVersion("0.9.9.21")]
36
[assembly: AssemblyFileVersion("0.9.9.25")]
37 37
// Log4netを使用する
38 38
[assembly: log4net.Config.XmlConfigurator(ConfigFile = @"log4net.config", Watch = true)]

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