リビジョン 16
経費計算・給与計算ロジックバグ修正
trunk/src/ProcessManagement/ProcessManagement/Common/CommonDefine.cs | ||
---|---|---|
1066 | 1066 |
/// <summary> |
1067 | 1067 |
/// 出勤補正値係数 |
1068 | 1068 |
/// </summary> |
1069 |
public static double s_SalaryExpenses = 1.1;
|
|
1069 |
public static double s_SalaryCorrection = 1.1;
|
|
1070 | 1070 |
#endregion |
1071 | 1071 |
|
1072 | 1072 |
#region 工事予算書:日付選択 |
... | ... | |
1317 | 1317 |
} |
1318 | 1318 |
#endregion |
1319 | 1319 |
|
1320 |
#region 台帳入力完了フラグ |
|
1320 |
#region 工事詳細台帳:台帳入力完了フラグ
|
|
1321 | 1321 |
/// <summary> |
1322 |
/// 台帳入力完了フラグ |
|
1322 |
/// 工事詳細台帳:台帳入力完了フラグ
|
|
1323 | 1323 |
/// </summary> |
1324 | 1324 |
public enum ComplateTitleNo |
1325 | 1325 |
{ |
... | ... | |
1333 | 1333 |
Complated, |
1334 | 1334 |
} |
1335 | 1335 |
#endregion |
1336 |
|
|
1337 |
#region 工事詳細台帳:増減工事フラグ |
|
1338 |
/// <summary> |
|
1339 |
/// 工事詳細台帳:増減工事フラグ |
|
1340 |
/// </summary> |
|
1341 |
public enum FluctuatesFlg |
|
1342 |
{ |
|
1343 |
/// <summary> |
|
1344 |
/// 0:通常データ |
|
1345 |
/// </summary> |
|
1346 |
Normal =0, |
|
1347 |
/// <summary> |
|
1348 |
/// 1:増減データ |
|
1349 |
/// </summary> |
|
1350 |
Fluctuates, |
|
1351 |
} |
|
1352 |
#endregion |
|
1336 | 1353 |
} |
1337 | 1354 |
} |
trunk/src/ProcessManagement/ProcessManagement/Common/Process/ClsChangeBaseInfoData.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.ComponentModel; |
|
4 |
using System.Data; |
|
5 |
using System.Drawing; |
|
6 |
using System.Linq; |
|
7 |
using System.Text; |
|
8 |
using System.Windows.Forms; |
|
9 |
using System.Collections; |
|
10 |
using System.Diagnostics; |
|
11 |
|
|
12 |
using log4net; |
|
13 |
using log4net.Appender; |
|
14 |
using log4net.Repository.Hierarchy; |
|
15 |
|
|
16 |
using ProcessManagement.Common; |
|
17 |
using ProcessManagement.DB.IOAccess; |
|
18 |
using ProcessManagement.DataModel; |
|
19 |
using ProcessManagement.Forms.Master; |
|
20 |
using ProcessManagement.Forms.DataEntry; |
|
21 |
using ProcessManagement.Forms.ControlsAction; |
|
22 |
using ProcessManagement.Forms.SubForms; |
|
23 |
|
|
24 |
//*----------------------- 工事基本情報データ変更クラス -----------------------* |
|
25 |
// 2016/10/06 Ver1.0.0.0 Create Source |
|
26 |
// |
|
27 |
// |
|
28 |
// |
|
29 |
//*----------------------------------------------------------------------------* |
|
30 |
namespace ProcessManagement.Common |
|
31 |
{ |
|
32 |
/// <summary> |
|
33 |
/// 工事基本情報データ変更クラス |
|
34 |
/// </summary> |
|
35 |
public static class ClsChangeBaseInfoData |
|
36 |
{ |
|
37 |
#region ログ定義 |
|
38 |
/// <summary> |
|
39 |
/// log4netログを使用する |
|
40 |
/// </summary> |
|
41 |
private static readonly ILog logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
|
42 |
#endregion |
|
43 |
|
|
44 |
#region 定数 |
|
45 |
|
|
46 |
#endregion |
|
47 |
|
|
48 |
#region 変数 |
|
49 |
#endregion |
|
50 |
|
|
51 |
#region 工事詳細台帳入力完了日セット処理 |
|
52 |
/// <summary> |
|
53 |
/// 工事詳細台帳入力完了日セット処理 |
|
54 |
/// </summary> |
|
55 |
/// <param name="SetDate"></param> |
|
56 |
/// <returns></returns> |
|
57 |
public static bool SetLedgerComplateDate(int ConstrCode, DateTime SetDate) |
|
58 |
{ |
|
59 |
IOConstructionBaseInfo BaseDB = new IOConstructionBaseInfo(); |
|
60 |
try |
|
61 |
{ |
|
62 |
// 工事詳細台帳入力完了日をセットする |
|
63 |
if (!BaseDB.UpdateFeild(ConstrCode, (int)IOConstructionBaseInfo.TableColumn.LEDGERCOMPLATEDATE, SetDate)) return false; |
|
64 |
|
|
65 |
return true; |
|
66 |
} |
|
67 |
catch (System.Exception ex) |
|
68 |
{ |
|
69 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
70 |
return false; |
|
71 |
} |
|
72 |
finally |
|
73 |
{ |
|
74 |
BaseDB.close(); BaseDB = null; |
|
75 |
} |
|
76 |
} |
|
77 |
#endregion |
|
78 |
} |
|
79 |
} |
trunk/src/ProcessManagement/ProcessManagement/Common/Process/ClsChangeLedgerData.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.ComponentModel; |
|
4 |
using System.Data; |
|
5 |
using System.Drawing; |
|
6 |
using System.Linq; |
|
7 |
using System.Text; |
|
8 |
using System.Windows.Forms; |
|
9 |
using System.Collections; |
|
10 |
using System.Diagnostics; |
|
11 |
|
|
12 |
using log4net; |
|
13 |
using log4net.Appender; |
|
14 |
using log4net.Repository.Hierarchy; |
|
15 |
|
|
16 |
using ProcessManagement.Common; |
|
17 |
using ProcessManagement.DB.IOAccess; |
|
18 |
using ProcessManagement.DataModel; |
|
19 |
using ProcessManagement.Forms.Master; |
|
20 |
using ProcessManagement.Forms.DataEntry; |
|
21 |
using ProcessManagement.Forms.ControlsAction; |
|
22 |
using ProcessManagement.Forms.SubForms; |
|
23 |
|
|
24 |
//*----------------------- 工事詳細台帳データ変更クラス -----------------------* |
|
25 |
// 2016/05/31 Ver1.0.0.0 Create Source |
|
26 |
// |
|
27 |
// |
|
28 |
// |
|
29 |
//*----------------------------------------------------------------------------* |
|
30 |
namespace ProcessManagement.Common |
|
31 |
{ |
|
32 |
/// <summary> |
|
33 |
/// 工事詳細台帳データ変更クラス |
|
34 |
/// </summary> |
|
35 |
public static class ClsChangeLedgerData |
|
36 |
{ |
|
37 |
#region ログ定義 |
|
38 |
/// <summary> |
|
39 |
/// log4netログを使用する |
|
40 |
/// </summary> |
|
41 |
private static readonly ILog logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
|
42 |
#endregion |
|
43 |
|
|
44 |
#region 定数 |
|
45 |
|
|
46 |
#endregion |
|
47 |
|
|
48 |
#region 変数 |
|
49 |
/// <summary> |
|
50 |
/// 工事施工台帳支払い実績先頭カラム数 |
|
51 |
/// </summary> |
|
52 |
private static int m_LedgerColumnCount = 0; |
|
53 |
#endregion |
|
54 |
|
|
55 |
#region 対象月の工事詳細台帳実行データを作成する(交通費・購入品等のみ) |
|
56 |
/// <summary> |
|
57 |
/// 対象月の工事詳細台帳実行データを作成する(交通費・購入品等のみ) |
|
58 |
/// </summary> |
|
59 |
/// <param name="PersonCode">担当者コード</param> |
|
60 |
/// <param name="TargetMonth">対象年月</param> |
|
61 |
/// <returns></returns> |
|
62 |
public static bool MakeLedgerData(int PersonCode, string TargetMonth) |
|
63 |
{ |
|
64 |
IOCostDataOfPerson CostDB = new IOCostDataOfPerson(); |
|
65 |
IOConstructionLedger LedgerDB = new IOConstructionLedger(); |
|
66 |
IOConstructionLedgerDetail LedgerDetailDB = new IOConstructionLedgerDetail(); |
|
67 |
IOConstructionLedgerExcute LedgerExcuteDB = new IOConstructionLedgerExcute(); |
|
68 |
try |
|
69 |
{ |
|
70 |
// 一括処理で登録を行う |
|
71 |
CostDB.connect(); |
|
72 |
LedgerDB.connect(); |
|
73 |
LedgerDetailDB.connect(); |
|
74 |
LedgerExcuteDB.connect(); LedgerExcuteDB.beginTran(); |
|
75 |
|
|
76 |
// 詳細台帳よりグリッドのカラムを取得する |
|
77 |
GetLedgerColumnCount(); |
|
78 |
|
|
79 |
// 対象をまず削除する(対象月で削除する) |
|
80 |
string strDelSQL = "DELETE CONSTRUCTIONLEDGEREXCUTE"; |
|
81 |
strDelSQL += " WHERE CONSTRUCTIONCODE IN"; |
|
82 |
strDelSQL += " (SELECT CONSTRUCTIONCODE FROM CONSTRUCTIONBASEINFO"; |
|
83 |
strDelSQL += string.Format(" WHERE (SALESPERSONCODE = {0} OR CONSTRUCTIONPERSONCODE = {0} OR CONSTRSUBPERSONCODE = {0} OR CONSTRUCTIONINSTRUCTOR = {0}))", PersonCode); |
|
84 |
strDelSQL += string.Format(" AND GROUPCOUNT IN ({0}, {1}, {2}, {3}, {4})" |
|
85 |
, GetConstructionLedgerGroupNo((int)CommonDefine.CostDataNo.Transport) |
|
86 |
, GetConstructionLedgerGroupNo((int)CommonDefine.CostDataNo.Purchase) |
|
87 |
, GetConstructionLedgerGroupNo((int)CommonDefine.CostDataNo.Lease) |
|
88 |
, GetConstructionLedgerGroupNo((int)CommonDefine.CostDataNo.StoragePlace) |
|
89 |
, GetConstructionLedgerGroupNo((int)CommonDefine.CostDataNo.Lodging)); |
|
90 |
strDelSQL += string.Format(" AND TARGETMONTH = TO_DATE('{0}','YYYY/MM/DD')", (TargetMonth + "/01")); |
|
91 |
LedgerExcuteDB.ExecuteNonQuery(strDelSQL, false); |
|
92 |
|
|
93 |
for (int i = (int)CommonDefine.CostDataNo.Transport; i <= (int)CommonDefine.CostDataNo.Lodging; i++) |
|
94 |
{ |
|
95 |
string strSQL = "SELECT CONSTRUCTIONCODE, DATATYPE, TO_CHAR(ACTIONDATE,'YYYY/MM'), SUM(ENTRYPRICE) FROM COSTDATAOFPERSON"; |
|
96 |
strSQL += String.Format(" WHERE TO_CHAR(ACTIONDATE,'YYYY/MM') = '{0}'", TargetMonth); |
|
97 |
strSQL += String.Format(" AND DATATYPE = {0}", i); |
|
98 |
strSQL += " AND CONSTRUCTIONCODE IN (SELECT CONSTRUCTIONCODE FROM CONSTRUCTIONBASEINFO"; |
|
99 |
strSQL += string.Format(" WHERE (SALESPERSONCODE = {0} OR CONSTRUCTIONPERSONCODE = {0} OR CONSTRSUBPERSONCODE = {0} OR CONSTRUCTIONINSTRUCTOR = {0}))", PersonCode); |
|
100 |
strSQL += " GROUP BY CONSTRUCTIONCODE, DATATYPE, TO_CHAR(ACTIONDATE,'YYYY/MM')"; |
|
101 |
strSQL += " ORDER BY CONSTRUCTIONCODE, DATATYPE"; |
|
102 |
ArrayList arList = new ArrayList(); |
|
103 |
if (!CostDB.ExecuteReader(strSQL, ref arList, false)) continue; |
|
104 |
if (arList.Count == 0) continue; |
|
105 |
|
|
106 |
foreach (object[] wrkrec in arList) |
|
107 |
{ |
|
108 |
|
|
109 |
// 支払金額 |
|
110 |
int PaymentPrice = CommonMotions.cnvInt(wrkrec[3]); |
|
111 |
// 支払金額無は処理しない |
|
112 |
if (PaymentPrice == 0) continue; |
|
113 |
|
|
114 |
// 工事番号 |
|
115 |
int ConstructionCode = CommonMotions.cnvInt(wrkrec[0]); |
|
116 |
|
|
117 |
// グループ番号 |
|
118 |
int DataType = i; |
|
119 |
int GroupNo = GetConstructionLedgerGroupNo(DataType); |
|
120 |
|
|
121 |
// 工事詳細台帳よりデータの行・列を取得する |
|
122 |
int LineCnt = 0; |
|
123 |
int ColCnt = 0; |
|
124 |
// 台帳が無ければ処理しない |
|
125 |
if (!SearchTatgetConstructionLedger(LedgerDB, LedgerDetailDB, ConstructionCode, GroupNo, TargetMonth, ref LineCnt, ref ColCnt)) continue; |
|
126 |
|
|
127 |
ConstructionLedgerExcute excRec = new ConstructionLedgerExcute(); |
|
128 |
// データ編集 |
|
129 |
excRec.ConstructionCode = ConstructionCode; |
|
130 |
excRec.GroupCount = GroupNo; |
|
131 |
excRec.LineCount = LineCnt; |
|
132 |
excRec.ColumnCount = ColCnt; |
|
133 |
excRec.PaymentAmount = PaymentPrice; |
|
134 |
excRec.TargetMonth = CommonMotions.cnvDate(TargetMonth + "/01"); |
|
135 |
|
|
136 |
if (!LedgerExcuteDB.InsertAction(excRec, false)) |
|
137 |
{ |
|
138 |
LedgerExcuteDB.rollback(); |
|
139 |
return false; |
|
140 |
} |
|
141 |
} |
|
142 |
} |
|
143 |
// DBコミット |
|
144 |
LedgerExcuteDB.commit(); |
|
145 |
|
|
146 |
return true; |
|
147 |
} |
|
148 |
catch (System.Exception ex) |
|
149 |
{ |
|
150 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
151 |
LedgerExcuteDB.rollback(); |
|
152 |
return false; |
|
153 |
} |
|
154 |
finally |
|
155 |
{ |
|
156 |
CostDB.close(); CostDB = null; |
|
157 |
LedgerDB.close(); LedgerDB = null; |
|
158 |
LedgerDetailDB.close(); LedgerDetailDB = null; |
|
159 |
LedgerExcuteDB.close(); LedgerExcuteDB = null; |
|
160 |
} |
|
161 |
} |
|
162 |
#endregion |
|
163 |
|
|
164 |
#region 工事詳細台帳より対象データを探して実行データの行番号・列番号を返す(交通費・購入品等のみ) |
|
165 |
/// <summary> |
|
166 |
/// 工事詳細台帳より対象データを探して実行データの行番号・列番号を返す(交通費・購入品等のみ) |
|
167 |
/// </summary> |
|
168 |
/// <returns></returns> |
|
169 |
private static bool SearchTatgetConstructionLedger(IOConstructionLedger LedgerDB, IOConstructionLedgerDetail LedgerDetailDB |
|
170 |
,int ConstructionCode, int GroupNo, string TargetMonth, ref int LineCnt, ref int ColCnt) |
|
171 |
{ |
|
172 |
try |
|
173 |
{ |
|
174 |
// 台帳データよりカラム数を取得する |
|
175 |
string strLedger = LedgerDB.CreatePrimarykeyString(ConstructionCode); |
|
176 |
ConstructionLedger LedgerRec = new ConstructionLedger(); |
|
177 |
if (!LedgerDB.SelectAction(strLedger, ref LedgerRec, false)) return false; |
|
178 |
|
|
179 |
// 現在の処理年月をDateTime型に変換する |
|
180 |
DateTime NowDates = CommonMotions.cnvDate(TargetMonth + "/01"); |
|
181 |
|
|
182 |
// 経過月数を取得する |
|
183 |
//TimeSpan ts = NowDates - LedgerRec.ConstructionStart; |
|
184 |
//int DiffMonth = ts.GetTimeSpanMonths(); |
|
185 |
int DiffMonth = (LedgerRec.ConstructionStart.Month + (LedgerRec.ConstructionStart.Year - NowDates.Year) * 12) - NowDates.Month; |
|
186 |
|
|
187 |
// 列番号取得 |
|
188 |
ColCnt = m_LedgerColumnCount + DiffMonth; |
|
189 |
|
|
190 |
// 工事詳細台帳明細データ読込み |
|
191 |
string strSQL = LedgerDetailDB.CreatePrimarykeyString(ConstructionCode, GroupNo); |
|
192 |
List<ConstructionLedgerDetail> DetailList = new List<ConstructionLedgerDetail>(); |
|
193 |
if (!LedgerDetailDB.SelectAction(strSQL, ref DetailList, false)) return false; |
|
194 |
// 行番号取得 |
|
195 |
LineCnt = DetailList[0].LineCount; |
|
196 |
|
|
197 |
return true; |
|
198 |
} |
|
199 |
catch (System.Exception ex) |
|
200 |
{ |
|
201 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
202 |
return false; |
|
203 |
} |
|
204 |
} |
|
205 |
#endregion |
|
206 |
|
|
207 |
#region 工事詳細台帳のグループ番号を取得する |
|
208 |
/// <summary> |
|
209 |
/// 工事詳細台帳のグループ番号を取得する |
|
210 |
/// </summary> |
|
211 |
/// <param name="TargetData"></param> |
|
212 |
/// <returns></returns> |
|
213 |
public static int GetConstructionLedgerGroupNo(int TargetData) |
|
214 |
{ |
|
215 |
int GroupNo = 0; |
|
216 |
// 工事台帳のグループ番号を取得する |
|
217 |
switch (TargetData) |
|
218 |
{ |
|
219 |
case (int)CommonDefine.CostDataNo.Transport: |
|
220 |
// 交通費(通行料・電車代) |
|
221 |
GroupNo = (int)FrmConstructionLedger.DataGroup.TransportationCosts; |
|
222 |
break; |
|
223 |
case (int)CommonDefine.CostDataNo.Purchase: |
|
224 |
// 購入品 |
|
225 |
GroupNo = (int)FrmConstructionLedger.DataGroup.PurchaseCosts; |
|
226 |
break; |
|
227 |
case (int)CommonDefine.CostDataNo.Lease: |
|
228 |
// 車両リース代 |
|
229 |
GroupNo = (int)FrmConstructionLedger.DataGroup.VehicleLeaseFee; |
|
230 |
break; |
|
231 |
case (int)CommonDefine.CostDataNo.StoragePlace: |
|
232 |
// 駐車場・資材置き場 |
|
233 |
GroupNo = (int)FrmConstructionLedger.DataGroup.ParkingCosts; |
|
234 |
break; |
|
235 |
case (int)CommonDefine.CostDataNo.Lodging: |
|
236 |
// 宿泊費 |
|
237 |
GroupNo = (int)FrmConstructionLedger.DataGroup.RoomChargeCosts; |
|
238 |
break; |
|
239 |
} |
|
240 |
return GroupNo; |
|
241 |
} |
|
242 |
#endregion |
|
243 |
|
|
244 |
#region 工事詳細台帳より支払金額グリッドの先頭カラム数を取得する |
|
245 |
/// <summary> |
|
246 |
/// 工事詳細台帳より支払金額グリッドの先頭カラム数を取得する |
|
247 |
/// </summary> |
|
248 |
private static void GetLedgerColumnCount() |
|
249 |
{ |
|
250 |
FrmConstructionLedger frm = new FrmConstructionLedger(); |
|
251 |
try |
|
252 |
{ |
|
253 |
m_LedgerColumnCount = frm.GetGridColumsCount - 1; |
|
254 |
} |
|
255 |
catch (System.Exception ex) |
|
256 |
{ |
|
257 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
258 |
} |
|
259 |
finally |
|
260 |
{ |
|
261 |
frm.Dispose(); frm = null; |
|
262 |
} |
|
263 |
} |
|
264 |
#endregion |
|
265 |
|
|
266 |
#region 個人毎経費データから工事詳細台帳の工事毎のデータ再計算更新処理 |
|
267 |
/// <summary> |
|
268 |
/// 個人毎経費データから工事詳細台帳の工事毎のデータ再計算更新処理 |
|
269 |
/// </summary> |
|
270 |
/// <param name="PersonCode"></param> |
|
271 |
/// <param name="TargetMonth"></param> |
|
272 |
/// <returns></returns> |
|
273 |
public static bool UpdateRecalLedgerDataFromTAndPCost(int PersonCode, string TargetMonth) |
|
274 |
{ |
|
275 |
IOCostDataOfPerson CostDB = new IOCostDataOfPerson(); |
|
276 |
FrmConstructionLedger frm = new FrmConstructionLedger(); |
|
277 |
try |
|
278 |
{ |
|
279 |
string strSQL = "SELECT PERSONCODE, TO_CHAR(ACTIONDATE,'YYYY/MM'), CONSTRUCTIONCODE FROM COSTDATAOFPERSON"; |
|
280 |
strSQL += String.Format(" WHERE PERSONCODE = {0} AND TO_CHAR(ACTIONDATE,'YYYY/MM') = '{1}'", PersonCode, TargetMonth); |
|
281 |
strSQL += " GROUP BY PERSONCODE, TO_CHAR(ACTIONDATE,'YYYY/MM'), CONSTRUCTIONCODE"; |
|
282 |
strSQL += " ORDER BY CONSTRUCTIONCODE"; |
|
283 |
|
|
284 |
ArrayList arList = new ArrayList(); |
|
285 |
if (!CostDB.ExecuteReader(strSQL, ref arList)) return false; |
|
286 |
if (arList.Count == 0) return true; |
|
287 |
|
|
288 |
bool bInit = true; |
|
289 |
foreach (object[] wrkobj in arList) |
|
290 |
{ |
|
291 |
int ConstructionCode = CommonMotions.cnvInt(wrkobj[2]); |
|
292 |
// 工事番号が存在しないデータは更新にしない |
|
293 |
if (ConstructionCode == 0) continue; |
|
294 |
|
|
295 |
// 工事コードのセット |
|
296 |
frm.ConstructionCode = ConstructionCode; |
|
297 |
|
|
298 |
if (bInit) |
|
299 |
{ |
|
300 |
// 見えない画面を出す |
|
301 |
frm.Hide(); |
|
302 |
// フォーム非表示 |
|
303 |
//frm.Visible = false; |
|
304 |
bInit = false; |
|
305 |
} |
|
306 |
// 再計算処理 |
|
307 |
bool bret = frm.RecalculateLedger; |
|
308 |
} |
|
309 |
|
|
310 |
// 画面を閉じる |
|
311 |
frm.Close(); |
|
312 |
} |
|
313 |
catch (System.Exception ex) |
|
314 |
{ |
|
315 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
316 |
return false; |
|
317 |
} |
|
318 |
finally |
|
319 |
{ |
|
320 |
CostDB.close(); CostDB = null; |
|
321 |
frm.Dispose(); frm = null; |
|
322 |
} |
|
323 |
return true; |
|
324 |
} |
|
325 |
#endregion |
|
326 |
|
|
327 |
#region 工事詳細台帳データを新規作成する |
|
328 |
/// <summary> |
|
329 |
/// 工事詳細台帳データを新規作成する |
|
330 |
/// </summary> |
|
331 |
/// <param name="ConstructionCode"></param> |
|
332 |
/// <returns></returns> |
|
333 |
public static bool MakingLedgerData(int ConstructionCode) |
|
334 |
{ |
|
335 |
IOConstructionLedger LedgerDB = new IOConstructionLedger(); |
|
336 |
FrmConstructionLedger frm = new FrmConstructionLedger(); |
|
337 |
try |
|
338 |
{ |
|
339 |
// 工事番号が存在しないデータは更新しない |
|
340 |
if (ConstructionCode == 0) return false; |
|
341 |
|
|
342 |
// 工事詳細台帳データが既にあれば作成しない |
|
343 |
string strExists = LedgerDB.CreatePrimarykeyString(ConstructionCode); |
|
344 |
List<ConstructionLedger> LedgerList = new List<ConstructionLedger>(); |
|
345 |
LedgerDB.SelectAction(strExists, ref LedgerList); |
|
346 |
if (LedgerList.Count > 0) return true; |
|
347 |
|
|
348 |
// 工事コードのセット |
|
349 |
frm.ConstructionCode = ConstructionCode; |
|
350 |
|
|
351 |
// 見えない画面を出す |
|
352 |
frm.WindowState = FormWindowState.Minimized; |
|
353 |
frm.Show(); |
|
354 |
// フォーム非表示 |
|
355 |
frm.Visible = false; |
|
356 |
|
|
357 |
bool bSuccess = true; |
|
358 |
// データ作成処理 |
|
359 |
if (!frm.SaveLedgerData) bSuccess = false; |
|
360 |
|
|
361 |
// 画面を閉じる |
|
362 |
frm.Close(); |
|
363 |
|
|
364 |
return bSuccess; |
|
365 |
} |
|
366 |
catch (System.Exception ex) |
|
367 |
{ |
|
368 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
369 |
return false; |
|
370 |
} |
|
371 |
finally |
|
372 |
{ |
|
373 |
frm.Dispose(); frm = null; |
|
374 |
LedgerDB.close(); LedgerDB = null; |
|
375 |
} |
|
376 |
} |
|
377 |
#endregion |
|
378 |
|
|
379 |
#region 工事詳細台帳データに増減データを追加する |
|
380 |
/// <summary> |
|
381 |
/// 工事詳細台帳データに増減データを追加する |
|
382 |
/// </summary> |
|
383 |
/// <param name="ConstructionCode"></param> |
|
384 |
/// <returns></returns> |
|
385 |
public static bool AddingLedgerData(int ConstructionCode) |
|
386 |
{ |
|
387 |
IOConstructionLink LinkDB = new IOConstructionLink(); |
|
388 |
IOConstructionLedger LedgerDB = new IOConstructionLedger(); |
|
389 |
FrmConstructionLedger frm = new FrmConstructionLedger(); |
|
390 |
try |
|
391 |
{ |
|
392 |
|
|
393 |
// 工事番号が存在しないデータは更新しない |
|
394 |
if (ConstructionCode == 0) return false; |
|
395 |
|
|
396 |
// 親の工事を探す |
|
397 |
string strParent = string.Format(" WHERE FluctuationCode = {0}", ConstructionCode); |
|
398 |
ConstructionLink LinkRec = new ConstructionLink(); |
|
399 |
if (!LinkDB.SelectAction(strParent, ref LinkRec)) return false; |
|
400 |
|
|
401 |
// 工事詳細台帳データが無い場合は処理しない |
|
402 |
string strExists = LedgerDB.CreatePrimarykeyString(LinkRec.ConstructionCode); |
|
403 |
ConstructionLedger LedgerList = new ConstructionLedger(); |
|
404 |
if (!LedgerDB.SelectAction(strExists, ref LedgerList)) return false; |
|
405 |
|
|
406 |
// 工事コードのセット |
|
407 |
frm.ConstructionCode = LinkRec.ConstructionCode; |
|
408 |
|
|
409 |
// 見えない画面を出す |
|
410 |
frm.WindowState = FormWindowState.Minimized; |
|
411 |
frm.Hide(); |
|
412 |
|
|
413 |
// データを追加する |
|
414 |
frm.AddingConstrCode = ConstructionCode; |
|
415 |
if (!frm.AddDataLedger) |
|
416 |
{ |
|
417 |
frm.Close(); // 画面を閉じる |
|
418 |
return false; |
|
419 |
} |
|
420 |
|
|
421 |
// データ作成処理 |
|
422 |
if (!frm.SaveLedgerData) |
|
423 |
{ |
|
424 |
frm.Close(); // 画面を閉じる |
|
425 |
return false; |
|
426 |
} |
|
427 |
|
|
428 |
// 画面を閉じる |
|
429 |
frm.Close(); |
|
430 |
|
|
431 |
return true; |
|
432 |
} |
|
433 |
catch (System.Exception ex) |
|
434 |
{ |
|
435 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
436 |
return false; |
|
437 |
} |
|
438 |
finally |
|
439 |
{ |
|
440 |
frm.Dispose(); frm = null; |
|
441 |
LedgerDB.close(); LedgerDB = null; |
|
442 |
LinkDB.close(); LinkDB = null; |
|
443 |
} |
|
444 |
} |
|
445 |
#endregion |
|
446 |
|
|
447 |
#region 工事詳細台帳データに対象行の支払い給与を計算する |
|
448 |
/// <summary> |
|
449 |
/// 工事詳細台帳データに対象行の支払い給与を計算する |
|
450 |
/// </summary> |
|
451 |
/// <param name="ConstrCode">工事番号</param> |
|
452 |
/// <param name="TargetDate">対象日</param> |
|
453 |
/// <param name="bSetFlag">月一括セットフラグ</param> |
|
454 |
/// <returns></returns> |
|
455 |
public static bool CalculatePayment(int ConstrCode, DateTime TargetDate, bool bSetFlag = false) |
|
456 |
{ |
|
457 |
IOConstructionLedger LedgerDB = new IOConstructionLedger(); |
|
458 |
IOConstructionLedgerDetail LedgerDeDB = new IOConstructionLedgerDetail(); |
|
459 |
IOConstructionLedgerExcute LedgerExDB = new IOConstructionLedgerExcute(); |
|
460 |
IOMPersonInCharge PersonDB = new IOMPersonInCharge(); |
|
461 |
FrmConstructionLedger frm = new FrmConstructionLedger(); |
|
462 |
try |
|
463 |
{ |
|
464 |
// 工事詳細台帳データ取得 |
|
465 |
List<ConstructionLedger> LedgerList = new List<ConstructionLedger>(); |
|
466 |
string LedgerSQL = LedgerDB.CreatePrimarykeyString(ConstrCode); |
|
467 |
if (!LedgerDB.SelectAction(LedgerSQL, ref LedgerList) || LedgerList.Count == 0) return false; |
|
468 |
|
|
469 |
// 工事詳細台帳明細データ取得 |
|
470 |
List<ConstructionLedgerDetail> DetailList = new List<ConstructionLedgerDetail>(); |
|
471 |
string DetailSQL = LedgerDeDB.CreatePrimarykeyString(ConstrCode); |
|
472 |
DetailSQL += string.Format(" AND OperatingFlg = {0}", (int)CommonDefine.SalaryOperateKind.Oparateing); // 対応中フラグ |
|
473 |
DetailSQL += string.Format(" AND GROUPCOUNT IN ({0},{1},{2})", |
|
474 |
(int)FrmConstructionLedger.DataGroup.Instructor, // 指導員給料 |
|
475 |
(int)FrmConstructionLedger.DataGroup.Assistant, // 副担当者給料 |
|
476 |
(int)FrmConstructionLedger.DataGroup.Payroll); // 担当者給料行 |
|
477 |
|
|
478 |
if (!LedgerDeDB.SelectAction(DetailSQL, ref DetailList) || DetailList.Count == 0) return false; |
|
479 |
|
|
480 |
// 対象月より書込みカラム位置を取得する |
|
481 |
int ColPoint = CalcTargetMonthToColumn(LedgerList[0].ConstructionStart, TargetDate); |
|
482 |
|
|
483 |
// 対象月の開始日・終了日を取得する |
|
484 |
DateTime dtStart = DateTimeUtil.BeginOfMonth(TargetDate); |
|
485 |
DateTime dtLast = DateTimeUtil.EndOfMonth(TargetDate); |
|
486 |
|
|
487 |
// 開始月は開始月を入れる |
|
488 |
if (LedgerList[0].ConstructionStart.Year == dtStart.Year |
|
489 |
&& LedgerList[0].ConstructionStart.Month == dtStart.Month) dtStart = LedgerList[0].ConstructionStart; |
|
490 |
|
|
491 |
// 当月は今日より大きい場合は今日を入れる |
|
492 |
if (DateTime.Now.Year == dtLast.Year |
|
493 |
&& DateTime.Now.Month == dtLast.Month |
|
494 |
&& DateTime.Now.Day < dtLast.Day) dtLast = DateTime.Now; |
|
495 |
|
|
496 |
// 終了月は終了日を入れる |
|
497 |
if (LedgerList[0].ConstructionEnd.Year == dtLast.Year |
|
498 |
&& LedgerList[0].ConstructionEnd.Month == dtLast.Month |
|
499 |
&& LedgerList[0].ConstructionEnd.Day < dtLast.Day) dtLast = LedgerList[0].ConstructionEnd; |
|
500 |
|
|
501 |
//// 稼働日数を取得する |
|
502 |
//int WorkingDay = ClsCalendar.CalcOperatingDaysCount(dtStart, dtLast); |
|
503 |
// 経過日数を取得する |
|
504 |
int WorkingDay = ClsCalendar.CalcPassedDaysCount(dtStart, dtLast); |
|
505 |
|
|
506 |
LedgerExDB.connect(); LedgerExDB.beginTran(); |
|
507 |
PersonDB.connect(); PersonDB.beginTran(); |
|
508 |
|
|
509 |
bool LoopBreak = false; |
|
510 |
foreach (ConstructionLedgerDetail CurRec in DetailList) |
|
511 |
{ |
|
512 |
// コードが担当者ではない場合は処理しない |
|
513 |
if (CurRec.CompanyType != (int)CommonDefine.SearchLogDataType.Person) continue; |
|
514 |
// コードがない場合は処理しない |
|
515 |
if (CurRec.CompanyCode == 0) continue; |
|
516 |
// 施工管理中担当者ではない場合は処理しない |
|
517 |
if (CurRec.OperatingFlg == (int)CommonDefine.SalaryOperateKind.Complate) continue; |
|
518 |
|
|
519 |
// 1日分の給与を取得する |
|
520 |
//double dSaraly = Get1DaysSalaryForOperating(PersonDB, CurRec.CompanyCode); |
|
521 |
double dSaraly = Get1DaysSalaryForFixed(PersonDB, CurRec.CompanyCode, CurRec.GroupCount); |
|
522 |
|
|
523 |
switch (CurRec.SalaryFlg) |
|
524 |
{ |
|
525 |
case (int)CommonDefine.SalaryDevision.All: // 全日振分 |
|
526 |
// 指定日までの稼働日数を掛けた値をセットする |
|
527 |
dSaraly *= WorkingDay; |
|
528 |
break; |
|
529 |
case (int)CommonDefine.SalaryDevision.Noting: // 振分無 |
|
530 |
// 給与振分無 |
|
531 |
dSaraly = 0; |
|
532 |
LoopBreak = true; |
|
533 |
break; |
|
534 |
case (int)CommonDefine.SalaryDevision.DaysInput: // 日数入力 |
|
535 |
// 日当加算判定を行う |
|
536 |
if (CheckPaymentValue(CurRec)) |
|
537 |
{ |
|
538 |
// 日数分掛ける |
|
539 |
dSaraly *= CurRec.SalaryDays; |
|
540 |
} |
|
541 |
else |
|
542 |
{ |
|
543 |
dSaraly = 0; |
|
544 |
} |
|
545 |
LoopBreak = true; |
|
546 |
break; |
|
547 |
default: |
|
548 |
break; |
|
549 |
} |
|
550 |
|
|
551 |
DateTime ParaDate = new DateTime(TargetDate.Year, TargetDate.Month, 1); |
|
552 |
// 支払いデータ書込み |
|
553 |
if (!AddOrSetSalary(LedgerExDB |
|
554 |
, ConstrCode, CurRec.GroupCount, CurRec.LineCount, ColPoint, (int)dSaraly, ParaDate)) |
|
555 |
{ |
|
556 |
LedgerExDB.rollback(); |
|
557 |
return false; |
|
558 |
} |
|
559 |
} |
|
560 |
// DB Commit |
|
561 |
LedgerExDB.commit(); |
|
562 |
|
|
563 |
bool bret = true; |
|
564 |
|
|
565 |
// 工事コードのセット |
|
566 |
frm.ConstructionCode = ConstrCode; |
|
567 |
|
|
568 |
// 見えない画面を出す |
|
569 |
frm.Hide(); |
|
570 |
// フォーム非表示 |
|
571 |
//frm.Visible = false; |
|
572 |
|
|
573 |
// 再計算処理 |
|
574 |
bret = frm.RecalculateLedger; |
|
575 |
|
|
576 |
// 画面を閉じる |
|
577 |
frm.Close(); |
|
578 |
|
|
579 |
// データ初期セット時に振分無・日数入力は次のループをしない |
|
580 |
if (bSetFlag && LoopBreak) bret = false; |
|
581 |
|
|
582 |
return bret; |
|
583 |
} |
|
584 |
catch (Exception ex) |
|
585 |
{ |
|
586 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
587 |
return false; |
|
588 |
} |
|
589 |
finally |
|
590 |
{ |
|
591 |
LedgerDB.close(); LedgerDB = null; |
|
592 |
LedgerDeDB.close(); LedgerDeDB = null; |
|
593 |
LedgerExDB.close(); LedgerExDB = null; |
|
594 |
PersonDB.close(); PersonDB = null; |
|
595 |
|
|
596 |
frm.Dispose(); frm = null; |
|
597 |
} |
|
598 |
} |
|
599 |
#endregion |
|
600 |
|
|
601 |
#region 日次処理での日当の加算を判定する |
|
602 |
/// <summary> |
|
603 |
/// 日次処理での日当の加算を判定する |
|
604 |
/// </summary> |
|
605 |
/// <param name="CurRec"></param> |
|
606 |
/// <returns></returns> |
|
607 |
private static bool CheckPaymentValue(ConstructionLedgerDetail CurRec) |
|
608 |
{ |
|
609 |
IOConstructionLedgerExcute ExcuteDB = new IOConstructionLedgerExcute(); |
|
610 |
try |
|
611 |
{ |
|
612 |
// 支払いデータより合計金額を取得する |
|
613 |
ArrayList arList = new ArrayList(); |
|
614 |
string ExcuteSQL = "SELECT SUM(PAYMENTAMOUNT) FROM CONSTRUCTIONLEDGEREXCUTE"; |
|
615 |
ExcuteSQL += string.Format(" WHERE CONSTRUCTIONCODE = {0}", CurRec.ConstructionCode); |
|
616 |
ExcuteSQL += string.Format(" AND GROUPCOUNT = {0}", CurRec.GroupCount); |
|
617 |
ExcuteSQL += string.Format(" AND LINECOUNT = {0}", CurRec.LineCount); |
|
618 |
if (!ExcuteDB.ExecuteReader(ExcuteSQL, ref arList) || arList.Count == 0) return false; |
|
619 |
|
|
620 |
object[] wrkobj = (object[])arList[0]; |
|
621 |
int TotalVal = CommonMotions.cnvInt(wrkobj[0]); |
|
622 |
|
|
623 |
bool bRet = false; |
|
624 |
if (TotalVal < CurRec.ExecutionAmount) bRet = true; |
|
625 |
|
|
626 |
return bRet; |
|
627 |
} |
|
628 |
catch (Exception ex) |
|
629 |
{ |
|
630 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
631 |
return false; |
|
632 |
} |
|
633 |
} |
|
634 |
#endregion |
|
635 |
|
|
636 |
#region 平均稼働数より1日分の給与を取得する |
|
637 |
/// <summary> |
|
638 |
/// 平均稼働数より1日分の給与を取得する |
|
639 |
/// </summary> |
|
640 |
/// <param name="PersonCode"></param> |
|
641 |
/// <returns></returns> |
|
642 |
private static double Get1DaysSalaryForOperating(IOMPersonInCharge PersonDB, int PersonCode, int GroupCount) |
|
643 |
{ |
|
644 |
try |
|
645 |
{ |
|
646 |
int monthSalary = 0; |
|
647 |
if (GroupCount == (int)FrmConstructionLedger.DataGroup.Payroll) |
|
648 |
{ // 担当者給与の場合 |
|
649 |
// 担当者マスタより給与月額を取得する |
|
650 |
string strPerson = PersonDB.CreatePrimarykeyString(PersonCode); |
|
651 |
PersonInChargeMaster personRec = new PersonInChargeMaster(); |
|
652 |
PersonDB.SelectAction(strPerson, ref personRec, false); |
|
653 |
|
|
654 |
// 出勤補正値係数を掛ける |
|
655 |
monthSalary = CommonMotions.cnvRound(personRec.MonthlySalary * (double)CommonDefine.s_SalaryCorrection); |
|
656 |
} |
|
657 |
else if (GroupCount == (int)FrmConstructionLedger.DataGroup.Instructor) |
|
658 |
{ |
|
659 |
// 指導員月額を取得する |
|
660 |
monthSalary = CommonDefine.InstructorMonthryCost; |
|
661 |
} |
|
662 |
else if (GroupCount == (int)FrmConstructionLedger.DataGroup.Assistant) |
|
663 |
{ |
|
664 |
// 副担当者月額を取得する |
|
665 |
monthSalary = CommonDefine.AssistantMonthryCost; |
|
666 |
} |
|
667 |
|
|
668 |
// 計算値を月稼働日数で割る |
|
669 |
double daylySalary = monthSalary / CommonDefine.s_WorkingDaysOfMonth; |
|
670 |
|
|
671 |
return daylySalary; |
|
672 |
} |
|
673 |
catch (Exception ex) |
|
674 |
{ |
|
675 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
676 |
return 0; |
|
677 |
} |
|
678 |
} |
|
679 |
#endregion |
|
680 |
|
|
681 |
#region 月工数より1日分の給与を取得する |
|
682 |
/// <summary> |
|
683 |
/// 月工数より1日分の給与を取得する |
|
684 |
/// </summary> |
|
685 |
/// <param name="PersonCode"></param> |
|
686 |
/// <returns></returns> |
|
687 |
private static double Get1DaysSalaryForFixed(IOMPersonInCharge PersonDB, int PersonCode, int GroupCount) |
|
688 |
{ |
|
689 |
try |
|
690 |
{ |
|
691 |
int monthSalary = 0; |
|
692 |
|
|
693 |
if (GroupCount == (int)FrmConstructionLedger.DataGroup.Payroll) |
|
694 |
{ // 担当者給与の場合 |
|
695 |
// 担当者マスタより給与月額を取得する |
|
696 |
string strPerson = PersonDB.CreatePrimarykeyString(PersonCode); |
|
697 |
PersonInChargeMaster personRec = new PersonInChargeMaster(); |
|
698 |
PersonDB.SelectAction(strPerson, ref personRec, false); |
|
699 |
|
|
700 |
// 出勤補正値係数を掛ける |
|
701 |
monthSalary = CommonMotions.cnvRound(personRec.MonthlySalary * (double)CommonDefine.s_SalaryCorrection); |
|
702 |
|
|
703 |
} |
|
704 |
else if (GroupCount == (int)FrmConstructionLedger.DataGroup.Instructor) |
|
705 |
{ |
|
706 |
// 指導員月額を取得する |
|
707 |
monthSalary = CommonDefine.InstructorMonthryCost; |
|
708 |
} |
|
709 |
else if (GroupCount == (int)FrmConstructionLedger.DataGroup.Assistant) |
|
710 |
{ |
|
711 |
// 副担当者月額を取得する |
|
712 |
monthSalary = CommonDefine.AssistantMonthryCost; |
|
713 |
} |
|
714 |
|
|
715 |
// 計算値を月工数日数で割る |
|
716 |
double daylySalary = CommonMotions.cnvRound(monthSalary / CommonDefine.s_ManHourUnitMonth); |
|
717 |
|
|
718 |
return daylySalary; |
|
719 |
} |
|
720 |
catch (Exception ex) |
|
721 |
{ |
|
722 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
723 |
return 0; |
|
724 |
} |
|
725 |
} |
|
726 |
#endregion |
|
727 |
|
|
728 |
#region 詳細台帳に指定金額を設定するか足しこむ |
|
729 |
/// <summary> |
|
730 |
/// 詳細台帳に指定金額を設定するか足しこむ |
|
731 |
/// </summary> |
|
732 |
/// <param name="LedgerExDB">詳細台帳支払いデータ</param> |
|
733 |
/// <param name="ConstrCode">工事番号</param> |
|
734 |
/// <param name="GroupCount">グループ番号</param> |
|
735 |
/// <param name="LineCount">行番号</param> |
|
736 |
/// <param name="ColumnCount">列番号</param> |
|
737 |
/// <param name="DaySalary">給与金額</param> |
|
738 |
/// <param name="ColumnDate">対象月</param> |
|
739 |
/// <param name="bSetFlag">セットフラグ</param> |
|
740 |
/// <returns></returns> |
|
741 |
private static bool AddOrSetSalary(IOConstructionLedgerExcute LedgerExDB |
|
742 |
, int ConstrCode, int GroupCount, int LineCount, int ColumnCount |
|
743 |
, int DaySalary, DateTime ColumnDate) |
|
744 |
{ |
|
745 |
try |
|
746 |
{ |
|
747 |
// キー作成 |
|
748 |
string strSQL = LedgerExDB.CreatePrimarykeyString(ConstrCode, GroupCount, LineCount, ColumnCount); |
|
749 |
strSQL += string.Format(" AND TargetMonth = TO_DATE('{0}','YYYY/MM/DD')", ColumnDate.ToShortDateString()); |
|
750 |
|
|
751 |
// データ読込み |
|
752 |
List<ConstructionLedgerExcute> LedgerExDBList = new List<ConstructionLedgerExcute>(); |
|
753 |
ConstructionLedgerExcute LedgerExDBRec = new ConstructionLedgerExcute(); |
|
754 |
bool ReadData = LedgerExDB.SelectAction(strSQL, ref LedgerExDBList, false); |
|
755 |
if (!ReadData || LedgerExDBList.Count == 0) |
|
756 |
{ |
|
757 |
LedgerExDBRec.ConstructionCode = ConstrCode; // 工事コード |
|
758 |
LedgerExDBRec.GroupCount = GroupCount; // グループ番号 |
|
759 |
LedgerExDBRec.LineCount = LineCount; // 行番号 |
|
760 |
LedgerExDBRec.ColumnCount = ColumnCount; // 列番号 |
|
761 |
LedgerExDBRec.PaymentAmount = DaySalary; // 支払金額 |
|
762 |
LedgerExDBRec.TargetMonth = ColumnDate; // 対象年月 |
|
763 |
|
|
764 |
// データ作成 |
|
765 |
bool bSaccess = LedgerExDB.InsertAction(LedgerExDBRec, false); |
|
766 |
|
|
767 |
if (bSaccess) return true; |
|
768 |
else return false; |
|
769 |
} |
|
770 |
|
|
771 |
// データ更新 |
|
772 |
if (!LedgerExDB.UpdateFeild(ConstrCode, GroupCount, LineCount, ColumnCount |
|
773 |
, (int)IOConstructionLedgerExcute.TableColumn.PaymentAmount, DaySalary, false)) return false; |
|
774 |
|
|
775 |
return true; |
|
776 |
} |
|
777 |
catch (Exception ex) |
|
778 |
{ |
|
779 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
780 |
return false; |
|
781 |
} |
|
782 |
} |
|
783 |
#endregion |
|
784 |
|
|
785 |
#region 対象年月から工事詳細台帳のグリッドカラム位置を算出する |
|
786 |
/// <summary> |
|
787 |
/// 対象年月から工事詳細台帳のグリッドカラム位置を算出する |
|
788 |
/// </summary> |
|
789 |
/// <param name="TargetMonth"></param> |
|
790 |
/// <returns></returns> |
|
791 |
private static int CalcTargetMonthToColumn(DateTime StartDate, DateTime TargetMonth) |
|
792 |
{ |
|
793 |
FrmConstructionLedger frm = new FrmConstructionLedger(); |
|
794 |
int Columncnt = frm.GetGridColumsCount - 1; |
|
795 |
try |
|
796 |
{ |
|
797 |
// 処理対象年月日を対象月月初日に変換する |
|
798 |
DateTime NowDates = DateTimeUtil.BeginOfMonth(TargetMonth); |
|
799 |
|
|
800 |
// 開始年月日を開始年月月初日に変換する |
|
801 |
DateTime StartMonth = DateTimeUtil.BeginOfMonth(StartDate); |
|
802 |
|
|
803 |
// 経過月数を取得する |
|
804 |
//TimeSpan ts = NowDates - StartDate; |
|
805 |
//int DiffMonth = ts.GetTimeSpanMonths(); |
|
806 |
int DiffMonth = (TargetMonth.Month + (TargetMonth.Year - StartDate.Year) * 12) - StartDate.Month; |
|
807 |
|
|
808 |
// 列番号取得 |
|
809 |
Columncnt += DiffMonth; |
|
810 |
|
|
811 |
return Columncnt; |
|
812 |
} |
|
813 |
catch (Exception ex) |
|
814 |
{ |
|
815 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
816 |
return Columncnt; |
|
817 |
} |
|
818 |
finally |
|
819 |
{ |
|
820 |
frm.Dispose(); frm = null; |
|
821 |
} |
|
822 |
} |
|
823 |
#endregion |
|
824 |
} |
|
825 |
} |
trunk/src/ProcessManagement/ProcessManagement/DataModel/DepartmentExpenses.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
|
|
6 |
namespace ProcessManagement.DataModel |
|
7 |
{ |
|
8 |
/// <summary> |
|
9 |
/// 部署経費率マスタ |
|
10 |
/// </summary> |
|
11 |
public class DepartmentExpenses |
|
12 |
{ |
|
13 |
#region メンバ変数 |
|
14 |
private int m_DepartmentCode = 0; // 工事種別コード |
|
15 |
private int m_ExpensesPeriod = 0; // 事業期 |
|
16 |
private int m_NameCode = 0; // 経費区分コード |
|
17 |
|
|
18 |
private int m_DisplayOrder = 0; // 表示順 |
|
19 |
private double m_ExpensesRatio = 0; // 経費率 |
|
20 |
private int m_DeleteFlg = 0; // 削除フラグ |
|
21 |
private DateTime m_EntryDate = DateTime.Now; // 登録日付 |
|
22 |
private DateTime m_UpdateDate = DateTime.Now; // 更新日付 |
|
23 |
#endregion |
|
24 |
|
|
25 |
#region コンストラクタ |
|
26 |
#endregion |
|
27 |
|
|
28 |
#region プロパティ |
|
29 |
/// <summary> |
|
30 |
/// 区分コード |
|
31 |
/// </summary> |
|
32 |
public int DepartmentCode |
|
33 |
{ |
|
34 |
get { return m_DepartmentCode; } |
|
35 |
set { m_DepartmentCode = value; } |
|
36 |
} |
|
37 |
/// <summary> |
|
38 |
/// 事業期 |
|
39 |
/// </summary> |
|
40 |
public int ExpensesPeriod |
|
41 |
{ |
|
42 |
get { return m_ExpensesPeriod; } |
|
43 |
set { m_ExpensesPeriod = value; } |
|
44 |
} |
|
45 |
/// <summary> |
|
46 |
/// 名称コード |
|
47 |
/// </summary> |
|
48 |
public int NameCode |
|
49 |
{ |
|
50 |
get { return m_NameCode; } |
|
51 |
set { m_NameCode = value; } |
|
52 |
} |
|
53 |
/// <summary> |
|
54 |
/// 表示順 |
|
55 |
/// </summary> |
|
56 |
public int DisplayOrder |
|
57 |
{ |
|
58 |
get { return m_DisplayOrder; } |
|
59 |
set { m_DisplayOrder = value; } |
|
60 |
} |
|
61 |
/// <summary> |
|
62 |
/// 経費率 |
|
63 |
/// </summary> |
|
64 |
public double ExpensesRatio |
|
65 |
{ |
|
66 |
get { return m_ExpensesRatio; } |
|
67 |
set { m_ExpensesRatio = value; } |
|
68 |
} |
|
69 |
/// <summary> |
|
70 |
/// 削除フラグ |
|
71 |
/// </summary> |
|
72 |
public int DeleteFlg |
|
73 |
{ |
|
74 |
get { return m_DeleteFlg; } |
|
75 |
set { m_DeleteFlg = value; } |
|
76 |
} |
|
77 |
/// <summary> |
|
78 |
/// 登録日付 |
|
79 |
/// </summary> |
|
80 |
public DateTime EntryDate |
|
81 |
{ |
|
82 |
set { m_EntryDate = value; } |
|
83 |
get { return m_EntryDate; } |
|
84 |
} |
|
85 |
/// <summary> |
|
86 |
/// 更新日付 |
|
87 |
/// </summary> |
|
88 |
public DateTime UpdateDate |
|
89 |
{ |
|
90 |
set { m_UpdateDate = value; } |
|
91 |
get { return m_UpdateDate; } |
|
92 |
} |
|
93 |
#endregion |
|
94 |
} |
|
95 |
} |
trunk/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstractionList/FrmConstructionListAuxiliary.cs | ||
---|---|---|
38 | 38 |
private static string[] s_SQLPart1 = new string[] { "SELECT A.CONSTRUCTIONCODE, A.CONSTRUCTIONPERIOD, B.DETAILSTRING, A.CONSTRUCTIONSTATUSFLG,", |
39 | 39 |
" C.PERSONCODE, C.PERSONNAME, C.DEPARTMENTCODE, C.DEPARTMENTNAME, C.MANDISPORDER, C.DEPDISPORDER,", |
40 | 40 |
" D.PERSONCODE, D.PERSONNAME, D.DEPARTMENTCODE, D.DEPARTMENTNAME, D.MANDISPORDER, D.DEPDISPORDER", |
41 |
" FROM CONSTRUCTIONBASEINFO A, CONSTRUCTIONBASEINFODETAIL B" };
|
|
41 |
" FROM CONSTRUCTIONBASEINFO A" }; |
|
42 | 42 |
|
43 |
private static string[] s_SQLPart2 = new string[] { ", (SELECT CA.CONSTRUCTIONCODE, CA.SALESPERSONCODE PERSONCODE, CB.PERSONNAME PERSONNAME,",
|
|
43 |
private static string[] s_SQLPart2 = new string[] { " LEFT JOIN (SELECT CA.CONSTRUCTIONCODE, CA.SALESPERSONCODE PERSONCODE, CB.PERSONNAME PERSONNAME,",
|
|
44 | 44 |
" CB.DEPARTMENTCODE DEPARTMENTCODE, CC.DEPARTMENTSTRING DEPARTMENTNAME,", |
45 | 45 |
" CB.DISPLAYORDER MANDISPORDER, CC.DISPLAYORDER DEPDISPORDER", |
46 |
" FROM CONSTRUCTIONBASEINFO CA, PERSONINCHARGEMASTER CB, DEPARTMENTMASTER CC", |
|
47 |
" WHERE CA.CONSTRUCTIONPERIOD = {0}", |
|
48 |
" AND CA.SALESPERSONCODE = CB.PERSONCODE(+) AND CB.DEPARTMENTCODE = CC.DEPARTMENTCODE(+)) C" }; |
|
46 |
" FROM CONSTRUCTIONBASEINFO CA", |
|
47 |
" LEFT JOIN PERSONINCHARGEMASTER CB ON CA.SALESPERSONCODE = CB.PERSONCODE", |
|
48 |
" LEFT JOIN DEPARTMENTMASTER CC ON CB.DEPARTMENTCODE = CC.DEPARTMENTCODE", |
|
49 |
" WHERE CA.CONSTRUCTIONPERIOD = {0}) C ON A.CONSTRUCTIONCODE = C.CONSTRUCTIONCODE" }; |
|
49 | 50 |
|
50 |
private static string[] s_SQLPart3 = new string[] { ", (SELECT DA.CONSTRUCTIONCODE, DA.CONSTRUCTIONPERSONCODE PERSONCODE, DB.PERSONNAME PERSONNAME,",
|
|
51 |
private static string[] s_SQLPart3 = new string[] { " LEFT JOIN (SELECT DA.CONSTRUCTIONCODE, DA.CONSTRUCTIONPERSONCODE PERSONCODE, DB.PERSONNAME PERSONNAME,",
|
|
51 | 52 |
" DB.DEPARTMENTCODE DEPARTMENTCODE, DC.DEPARTMENTSTRING DEPARTMENTNAME,", |
52 | 53 |
" DB.DISPLAYORDER MANDISPORDER, DC.DISPLAYORDER DEPDISPORDER", |
53 |
" FROM CONSTRUCTIONBASEINFO DA, PERSONINCHARGEMASTER DB, DEPARTMENTMASTER DC", |
|
54 |
" WHERE DA.CONSTRUCTIONPERIOD = {0}", |
|
55 |
" AND DA.CONSTRUCTIONPERSONCODE = DB.PERSONCODE(+) AND DB.DEPARTMENTCODE = DC.DEPARTMENTCODE(+)) D" }; |
|
54 |
" FROM CONSTRUCTIONBASEINFO DA", |
|
55 |
" LEFT JOIN PERSONINCHARGEMASTER DB ON DA.CONSTRUCTIONPERSONCODE = DB.PERSONCODE", |
|
56 |
" LEFT JOIN DEPARTMENTMASTER DC ON DB.DEPARTMENTCODE = DC.DEPARTMENTCODE", |
|
57 |
" WHERE DA.CONSTRUCTIONPERIOD = {0}) D ON A.CONSTRUCTIONCODE = D.CONSTRUCTIONCODE", |
|
58 |
", CONSTRUCTIONBASEINFODETAIL B" }; |
|
56 | 59 |
|
57 | 60 |
private static string[] s_SQLPart4 = new string[] { " WHERE A.CONSTRUCTIONPERIOD = {0}", |
58 | 61 |
" AND A.CONSTRUCTIONCODE = B.CONSTRUCTIONCODE", |
... | ... | |
63 | 66 |
" AND A.CONSTRUCTIONCODE = B.CONSTRUCTIONCODE", |
64 | 67 |
" AND B.DETAILNO = {1}" }; |
65 | 68 |
|
66 |
private static string[] s_SQLPart5 = new string[] { " AND A.CONSTRUCTIONCODE = C.CONSTRUCTIONCODE(+)", |
|
67 |
" AND A.CONSTRUCTIONCODE = D.CONSTRUCTIONCODE(+)" }; |
|
68 |
|
|
69 |
private static string[] s_SQLPart6 = new string[] { " ORDER BY A.CONSTRUCTIONSTATUSFLG ASC, C.DEPDISPORDER ASC, C.MANDISPORDER ASC,", |
|
69 |
private static string[] s_SQLPart5 = new string[] { " ORDER BY A.CONSTRUCTIONSTATUSFLG ASC, C.DEPDISPORDER ASC, C.MANDISPORDER ASC,", |
|
70 | 70 |
" D.DEPDISPORDER ASC, D.MANDISPORDER ASC, A.CONSTRUCTIONCODE DESC" }; |
71 | 71 |
#endregion |
72 | 72 |
|
... | ... | |
286 | 286 |
for (int i = 0; i < s_SQLPart1.Length; i++) wrkFormat += s_SQLPart1[i]; |
287 | 287 |
for (int i = 0; i < s_SQLPart2.Length; i++) wrkFormat += s_SQLPart2[i]; |
288 | 288 |
for (int i = 0; i < s_SQLPart3.Length; i++) wrkFormat += s_SQLPart3[i]; |
289 |
//for (int i = 0; i < s_SQLPart4.Length; i++) wrkFormat += s_SQLPart4[i]; |
|
290 | 289 |
for (int i = 0; i < s_SQLPart4Tying.Length; i++) wrkFormat += s_SQLPart4Tying[i]; |
291 |
for (int i = 0; i < s_SQLPart5.Length; i++) wrkFormat += s_SQLPart5[i]; |
|
292 | 290 |
|
293 | 291 |
strSQL = string.Format(wrkFormat, numUDConstPro.Value, (int)ConstructionBaseInfoDetail.DetailDataNo.ConstructionName); |
294 | 292 |
|
... | ... | |
304 | 302 |
strSQL += wrkBuff; |
305 | 303 |
|
306 | 304 |
// ORDER BY ??? |
307 |
for (int i = 0; i < s_SQLPart6.Length; i++) strSQL += s_SQLPart6[i];
|
|
305 |
for (int i = 0; i < s_SQLPart5.Length; i++) strSQL += s_SQLPart5[i];
|
|
308 | 306 |
|
309 | 307 |
} |
310 | 308 |
#endregion |
... | ... | |
328 | 326 |
for (int i = 0; i < s_SQLPart2.Length; i++) wrkFormat += s_SQLPart2[i]; |
329 | 327 |
for (int i = 0; i < s_SQLPart3.Length; i++) wrkFormat += s_SQLPart3[i]; |
330 | 328 |
for (int i = 0; i < s_SQLPart4.Length; i++) wrkFormat += s_SQLPart4[i]; |
331 |
for (int i = 0; i < s_SQLPart5.Length; i++) wrkFormat += s_SQLPart5[i]; |
|
332 | 329 |
|
333 | 330 |
strSQL = string.Format(wrkFormat, numUDConstPro.Value, (int)ConstructionBaseInfoDetail.DetailDataNo.ConstructionName); |
334 | 331 |
strSQL += string.Format(" AND A.ConstructionStatusFlg < {0}", ProgressComplete); |
... | ... | |
382 | 379 |
for (int i = 0; i < s_SQLPart3.Length; i++) wrkFormat += s_SQLPart3[i]; |
383 | 380 |
wrkFormat += ", PROCESSAPPROVAL A1"; |
384 | 381 |
for (int i = 0; i < s_SQLPart4.Length; i++) wrkFormat += s_SQLPart4[i]; |
385 |
for (int i = 0; i < s_SQLPart5.Length; i++) wrkFormat += s_SQLPart5[i]; |
|
386 | 382 |
|
387 | 383 |
strSQL = string.Format(wrkFormat, numUDConstPro.Value, (int)ConstructionBaseInfoDetail.DetailDataNo.ConstructionName); |
388 | 384 |
strSQL += string.Format(" AND (A.CONSTRUCTIONCODE = A1.CONSTRUCTIONCODE And A1.ApprovalCode = {0} And A1.SeqNo = 1", ApprovalCode); |
... | ... | |
400 | 396 |
strSQL += wrkBuff; |
401 | 397 |
|
402 | 398 |
// ORDER BY ??? |
403 |
for (int i = 0; i < s_SQLPart6.Length; i++) strSQL += s_SQLPart6[i];
|
|
399 |
for (int i = 0; i < s_SQLPart5.Length; i++) strSQL += s_SQLPart5[i];
|
|
404 | 400 |
} |
405 | 401 |
#endregion |
406 | 402 |
|
... | ... | |
423 | 419 |
for (int i = 0; i < s_SQLPart2.Length; i++) wrkFormat += s_SQLPart2[i]; |
424 | 420 |
for (int i = 0; i < s_SQLPart3.Length; i++) wrkFormat += s_SQLPart3[i]; |
425 | 421 |
for (int i = 0; i < s_SQLPart4.Length; i++) wrkFormat += s_SQLPart4[i]; |
426 |
for (int i = 0; i < s_SQLPart5.Length; i++) wrkFormat += s_SQLPart5[i]; |
|
427 | 422 |
|
428 | 423 |
strSQL = string.Format(wrkFormat, numUDConstPro.Value, (int)ConstructionBaseInfoDetail.DetailDataNo.ConstructionName); |
429 | 424 |
strSQL += " AND EXISTS (SELECT * FROM ESTIMATEDATA C WHERE C.CONSTRUCTIONCODE = A.CONSTRUCTIONCODE)"; |
... | ... | |
487 | 482 |
wrkFormat += ", PROCESSAPPROVAL A1"; |
488 | 483 |
for (int i = 0; i < s_SQLPart4.Length; i++) wrkFormat += s_SQLPart4[i]; |
489 | 484 |
wrkFormat += " AND A.CONSTRUCTIONPERSONCODE != 0"; |
490 |
for (int i = 0; i < s_SQLPart5.Length; i++) wrkFormat += s_SQLPart5[i]; |
|
491 | 485 |
|
492 | 486 |
strSQL = string.Format(wrkFormat, numUDConstPro.Value, (int)ConstructionBaseInfoDetail.DetailDataNo.ConstructionName); |
493 | 487 |
strSQL += " AND EXISTS (SELECT * FROM ESTIMATEDATA B1 WHERE B1.CONSTRUCTIONCODE = A.CONSTRUCTIONCODE)"; |
... | ... | |
554 | 548 |
for (int i = 0; i < s_SQLPart3.Length; i++) wrkFormat += s_SQLPart3[i]; |
555 | 549 |
wrkFormat += ", PROCESSAPPROVAL A1"; |
556 | 550 |
for (int i = 0; i < s_SQLPart4.Length; i++) wrkFormat += s_SQLPart4[i]; |
557 |
for (int i = 0; i < s_SQLPart5.Length; i++) wrkFormat += s_SQLPart5[i]; |
|
551 |
//for (int i = 0; i < s_SQLPart5.Length; i++) wrkFormat += s_SQLPart5[i];
|
|
558 | 552 |
|
559 | 553 |
strSQL = string.Format(wrkFormat, numUDConstPro.Value, (int)ConstructionBaseInfoDetail.DetailDataNo.ConstructionName); |
560 | 554 |
strSQL += " AND NOT EXISTS (SELECT * FROM PURCHASEORDER B1 WHERE B1.CONSTRUCTIONCODE = A.CONSTRUCTIONCODE)"; |
... | ... | |
584 | 578 |
for (int i = 0; i < s_SQLPart3.Length; i++) wrkFormat += s_SQLPart3[i]; |
585 | 579 |
wrkFormat += ", PURCHASEORDER A1"; |
586 | 580 |
for (int i = 0; i < s_SQLPart4.Length; i++) wrkFormat += s_SQLPart4[i]; |
587 |
for (int i = 0; i < s_SQLPart5.Length; i++) wrkFormat += s_SQLPart5[i]; |
|
588 | 581 |
|
589 | 582 |
strSQL += " UNION "; |
590 | 583 |
strSQL += string.Format(wrkFormat, numUDConstPro.Value, (int)ConstructionBaseInfoDetail.DetailDataNo.ConstructionName); |
... | ... | |
634 | 627 |
for (int i = 0; i < s_SQLPart3.Length; i++) wrkFormat += s_SQLPart3[i]; |
635 | 628 |
wrkFormat += ", PROCESSAPPROVAL A1, PURCHASEORDER A2"; |
636 | 629 |
for (int i = 0; i < s_SQLPart4.Length; i++) wrkFormat += s_SQLPart4[i]; |
637 |
for (int i = 0; i < s_SQLPart5.Length; i++) wrkFormat += s_SQLPart5[i]; |
|
638 | 630 |
|
639 | 631 |
strSQL = string.Format(wrkFormat, numUDConstPro.Value, (int)ConstructionBaseInfoDetail.DetailDataNo.ConstructionName); |
640 | 632 |
strSQL += " AND EXISTS (SELECT * FROM ESTIMATEDATA B1 WHERE B1.CONSTRUCTIONCODE = A.CONSTRUCTIONCODE)"; |
trunk/src/ProcessManagement/ProcessManagement/Forms/DataEntry/ConstructionBaseInfo/DataChange.cs | ||
---|---|---|
33 | 33 |
/// </summary> |
34 | 34 |
partial class FrmConstructionBaseInfo |
35 | 35 |
{ |
36 |
#region ?????H?????????z???v???????? |
|
37 |
/// <summary> |
|
38 |
/// ?????H?????????z???v???????? |
|
39 |
/// </summary> |
|
40 |
/// <param name="cbiDB"></param> |
|
41 |
/// <param name="work"></param> |
|
42 |
private int FluctuationDataOrdersPrice(IOConstructionBaseInfo cbiDB) |
|
43 |
{ |
|
44 |
try |
|
45 |
{ |
|
46 |
int iCode1 = CommonDefine.ProjectsStatus.First(x => x.Value.Equals("?? ?? ??")).Key; |
|
47 |
|
|
48 |
string strSQL = "SELECT SUM(ORDERSDECISIONPRICE) FROM CONSTRUCTIONBASEINFO"; |
|
49 |
strSQL += string.Format(" WHERE (TRUNC(CONSTRUCTIONCODE / 100) = {0})", (int)(m_ConstructionCode / 100)); |
|
50 |
strSQL += string.Format(" AND CONSTRUCTIONSTATUSFLG != {0})", iCode1); |
|
51 |
strSQL += " GROUP BY TRUNC(CONSTRUCTIONCODE / 100)"; |
|
52 |
|
|
53 |
ArrayList Arlist = new ArrayList(); |
|
54 |
if (!cbiDB.ExecuteReader(strSQL, ref Arlist, false)) return 0; |
|
55 |
if (Arlist.Count == 0) return 0; |
|
56 |
|
|
57 |
object[] objCur = (object[])Arlist[0]; |
|
58 |
|
|
59 |
return CommonMotions.cnvInt(objCur[0]); |
|
60 |
} |
|
61 |
catch (System.Exception ex) |
|
62 |
{ |
|
63 |
logger.ErrorFormat("?V?X?e???G???[?F{0}?F{1}", CommonMotions.GetMethodName(), ex.Message); |
|
64 |
return 0; |
|
65 |
} |
|
66 |
} |
|
67 |
#endregion |
|
68 |
|
|
69 |
#region ???^???z?v?Z???? |
|
70 |
/// <summary> |
|
71 |
/// ???^???z?v?Z???? |
|
72 |
/// </summary> |
|
73 |
/// <param name="MonthryCost"></param> |
|
74 |
/// <param name="OrdersDecisionPrice"></param> |
|
75 |
/// <param name="ConstructionStart"></param> |
|
76 |
/// <param name="ConstructionEnd"></param> |
|
77 |
/// <param name="ExecutionAmount"></param> |
|
78 |
/// <param name="AmountConfigRate"></param> |
|
79 |
private void CalcPayValueData(double MonthryCost, double OrdersDecisionPrice, DateTime ConstructionStart, DateTime ConstructionEnd, |
|
80 |
ref double ExecutionAmount, ref double AmountConfigRate) |
|
81 |
{ |
|
82 |
try |
|
83 |
{ |
|
84 |
if (OrdersDecisionPrice == 0) return; |
|
85 |
|
|
86 |
// ?????v?Z |
|
87 |
double DairySalary = (MonthryCost * CommonDefine.s_SalaryCorrection) / CommonDefine.s_ManHourUnitMonth; |
|
88 |
// ??????v?Z |
|
89 |
int workingCount = ClsCalendar.CalcPassedDaysCount(ConstructionStart, ConstructionEnd); |
|
90 |
|
|
91 |
int iInput = CommonMotions.cnvRound(DairySalary * workingCount); // ???^?x?????z |
|
92 |
|
|
93 |
ExecutionAmount = iInput; // ???s???z |
|
94 |
|
|
95 |
AmountConfigRate = (iInput / OrdersDecisionPrice) * 100.0; // ???z?\???? |
|
96 |
|
|
97 |
} |
|
98 |
catch (Exception ex) |
|
99 |
{ |
|
100 |
logger.ErrorFormat("?V?X?e???G???[?F{0}?F{1}", CommonMotions.GetMethodName(), ex.Message); |
|
101 |
} |
|
102 |
} |
|
103 |
#endregion |
|
104 |
|
|
36 | 105 |
// ---------- ?????H?????? |
37 | 106 |
#region ?H?????f?[?^?? |
38 | 107 |
/// <summary> |
... | ... | |
162 | 231 |
// ????i?????t?f?[?^?o?^ |
163 | 232 |
if (!frm.ProgressDate(PDateDB, NewCode)) |
164 | 233 |
{ |
165 |
MessageBox.Show("??????i?????t?f?[?^?o?^????s????????B", "?f?[?^???G???[", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
234 |
MessageBox.Show("????i?????t?f?[?^?o?^????s????????B", "?f?[?^???G???[", MessageBoxButtons.OK, MessageBoxIcon.Error); |
|
166 | 235 |
PDateDB.rollback(); |
167 | 236 |
LinkDB.rollback(); |
168 | 237 |
BaseDB.rollback(); |
... | ... | |
399 | 468 |
/// ?H???\?Z???F?f?[?^??X |
400 | 469 |
/// </summary> |
401 | 470 |
/// <returns></returns> |
402 |
private bool BudgetDataChange(IOProcessApproval ApprovalDB, IOConstructionBudget BudgetDB, IOConstructionBudgetDetail BudgetDDB, IOMPersonInCharge PersonDB) |
|
471 |
private bool BudgetDataChange(IOProcessApproval ApprovalDB, |
|
472 |
IOConstructionBudget BudgetDB, |
|
473 |
IOConstructionBudgetDetail BudgetDDB, |
|
474 |
IOMPersonInCharge PersonDB, |
|
475 |
int TotalOrdersPrice) |
|
403 | 476 |
{ |
404 | 477 |
FrmConstructionBudget frm = new FrmConstructionBudget(); |
405 | 478 |
try |
... | ... | |
454 | 527 |
} |
455 | 528 |
// ----- ?H???\?Z??????f?[?^???? |
456 | 529 |
// ?H???S???? |
457 |
if (!BudgetDetailDataConstructorSet(BudgetDDB, frm, ConstrPersonCode, ConstrPersonName, BudgetRec, |
|
458 |
personRec.MonthlySalary, ExpensesList)) return false; |
|
530 |
if (!BudgetDetailDataSalarySet(frm, BudgetDDB, BudgetRec, TotalOrdersPrice |
|
531 |
, (int)FrmConstructionBudget.DataGroup.PayrollExpenses, ConstrPersonCode, ConstrPersonName |
|
532 |
, personRec.MonthlySalary, ExpensesList)) return false; |
|
459 | 533 |
|
460 | 534 |
// ?H?????S???? |
461 |
if (!BudgetDetailDataAssistantSet(BudgetDDB, frm, AssistantCode, AssistantName, BudgetRec)) return false; |
|
535 |
if (!BudgetDetailDataSalarySet(frm, BudgetDDB, BudgetRec, TotalOrdersPrice |
|
536 |
, (int)FrmConstructionBudget.DataGroup.AssistantCosts, AssistantCode, AssistantName |
|
537 |
, CommonDefine.AssistantMonthryCost, ExpensesList)) return false; |
|
462 | 538 |
|
463 | 539 |
// ?H???w???? |
464 |
if (!BudgetDetailDataInstructorSet(BudgetDDB, frm, InstructorCode, InstructorName, BudgetRec)) return false; |
|
540 |
if (!BudgetDetailDataSalarySet(frm, BudgetDDB, BudgetRec, TotalOrdersPrice |
|
541 |
, (int)FrmConstructionBudget.DataGroup.InstructorCosts, InstructorCode, InstructorName |
|
542 |
, CommonDefine.InstructorMonthryCost, ExpensesList)) return false; |
|
465 | 543 |
|
466 | 544 |
return true; |
467 | 545 |
} |
... | ... | |
491 | 569 |
/// ?o?? |
492 | 570 |
/// </summary> |
493 | 571 |
ExpensesRate, |
572 |
/// <summary> |
|
573 |
/// ?o????R?[?h |
|
574 |
/// </summary> |
|
575 |
NameCode, |
|
494 | 576 |
} |
495 | 577 |
#endregion |
496 | 578 |
|
... | ... | |
505 | 587 |
try |
506 | 588 |
{ |
507 | 589 |
// ?????o???}?X?^?? |
508 |
string strSQL = "SELECT A.NAMESTRING, NVL(B.EXPENSESRATIO, 0)"; |
|
590 |
string strSQL = "SELECT A.NAMESTRING, NVL(B.EXPENSESRATIO, 0), B.NAMECODE";
|
|
509 | 591 |
strSQL += " FROM DIVISIONMASTER A"; |
510 | 592 |
strSQL += " LEFT OUTER JOIN"; |
511 | 593 |
strSQL += string.Format(" (SELECT NAMECODE, DEPARTMENTCODE, EXPENSESRATIO FROM DEPARTMENTEXPENSESMASTER WHERE DEPARTMENTCODE = {0}) B", DepartmentCode); |
... | ... | |
547 | 629 |
if (BudgetRec.CreatorCode == ConstrPersonCode) goto SecondProc; |
548 | 630 |
|
549 | 631 |
// ?o????l?W?????|?????????????? |
550 |
MonthlySalary = CommonMotions.cnvRound(MonthlySalary * (double)CommonDefine.s_SalaryExpenses);
|
|
632 |
MonthlySalary = CommonMotions.cnvRound(MonthlySalary * (double)CommonDefine.s_SalaryCorrection);
|
|
551 | 633 |
|
552 | 634 |
if (ConstrPersonCode == 0) |
553 | 635 |
{ |
... | ... | |
692 | 774 |
work.GroupCount = (int)FrmConstructionBudget.DataGroup.Expenses; |
693 | 775 |
// ?s??? |
694 | 776 |
work.LineCount = icnt++; |
777 |
// ?o????R?[?h |
|
778 |
work.ComponentCode = CommonMotions.cnvInt(wrkExpense[(int)ExpensesArray.NameCode]); |
|
695 | 779 |
// ??????? |
696 | 780 |
string strVallue = CommonMotions.cnvString(wrkExpense[(int)ExpensesArray.ExpensesName]); |
697 | 781 |
work.FirstString = string.Format("{0}({1}%)", strVallue, dExpenses.ToString("0.00")); |
... | ... | |
716 | 800 |
} |
717 | 801 |
#endregion |
718 | 802 |
|
719 |
#region ?H???\?Z???F?S????Z?b?g |
|
803 |
#region ?H???\?Z???F?S????E???S????E?w?????Z?b?g
|
|
720 | 804 |
/// <summary> |
721 |
/// ?H???\?Z???F?S????Z?b?g |
|
805 |
/// ?H???\?Z???F?S????E???S????E?w?????Z?b?g
|
|
722 | 806 |
/// </summary> |
723 |
/// <param name="ApprovalNo"></param> |
|
807 |
/// <param name="frm"></param> |
|
808 |
/// <param name="BudgetDDB"></param> |
|
809 |
/// <param name="BudgetRec"></param> |
|
810 |
/// <param name="TotalOrdersPrice"></param> |
|
811 |
/// <param name="GroupNo"></param> |
|
812 |
/// <param name="ConstructorCode"></param> |
|
813 |
/// <param name="ConstructorName"></param> |
|
814 |
/// <param name="MonthryCost"></param> |
|
815 |
/// <param name="ExpensesList"></param> |
|
724 | 816 |
/// <returns></returns> |
725 |
private bool BudgetDetailDataConstructorSet(IOConstructionBudgetDetail BudgetDDB, FrmConstructionBudget frm |
|
726 |
, int ConstructorCode, string ConstructorName |
|
727 |
, ConstructionBudget BudgetRec, double MonthryCost |
|
728 |
, ArrayList ExpensesList) |
|
817 |
private bool BudgetDetailDataSalarySet(FrmConstructionBudget frm, IOConstructionBudgetDetail BudgetDDB, ConstructionBudget BudgetRec, int TotalOrdersPrice |
|
818 |
, int GroupNo, int ConstructorCode, string ConstructorName |
|
819 |
, double MonthryCost, ArrayList ExpensesList) |
|
729 | 820 |
{ |
730 | 821 |
try |
731 | 822 |
{ |
732 |
string strSQL = BudgetDDB.CreatePrimarykeyString(m_ConstructionCode, (int)FrmConstructionBudget.DataGroup.PayrollExpenses);
|
|
823 |
string strSQL = BudgetDDB.CreatePrimarykeyString(m_ConstructionCode, GroupNo);
|
|
733 | 824 |
ConstructionBudgetDetail DetailRec = new ConstructionBudgetDetail(); |
734 | 825 |
// ?H???\?Z??????f?[?^?????????????O?????????s |
735 | 826 |
bool UpdateFlg = BudgetDDB.SelectAction(strSQL, ref DetailRec, false); |
... | ... | |
737 | 828 |
// ?S????????????????????? |
738 | 829 |
if (DetailRec.CompanyCode == ConstructorCode) return true; |
739 | 830 |
|
740 |
// ????z?? |
|
741 |
double dBase = (int)CommonMotions.cnvUndecidedStringToDouble(m_DspCtrl[(int)DspCnt.OrdersDecisionPrice].Text); |
|
831 |
// ???^???z?Z?b?g |
|
832 |
double ExecutionAmount = 0; |
|
833 |
double AmountConfigRate = 0; |
|
834 |
CalcPayValueData(MonthryCost, TotalOrdersPrice, |
|
835 |
BudgetRec.ConstructionStart, BudgetRec.ConstructionEnd, |
|
836 |
ref ExecutionAmount, ref AmountConfigRate); |
|
742 | 837 |
|
743 |
// ?o????l?W?????|?????????????? |
|
744 |
MonthryCost = CommonMotions.cnvRound(CommonMotions.cnvRound(MonthryCost * (double)CommonDefine.s_SalaryExpenses)); |
|
745 |
|
|
746 | 838 |
// ??????N???A???????????f?[?^???Z?b?g |
747 | 839 |
if (ConstructorCode == 0) |
748 | 840 |
{ |
... | ... | |
751 | 843 |
else |
752 | 844 |
{ |
753 | 845 |
DetailRec.CompanyType = (int)CommonDefine.SearchLogDataType.Person; |
754 |
DetailRec.OrderDesiredAmount = CommonDefine.AssistantMonthryCost * BudgetRec.ConstructionTimes;
|
|
755 |
DetailRec.ExecutionAmount = DetailRec.OrderDesiredAmount;
|
|
756 |
DetailRec.AmountConfigRate = CommonMotions.cnvRound(DetailRec.ExecutionAmount / dBase * 100.0);
|
|
846 |
DetailRec.OrderDesiredAmount = ExecutionAmount;
|
|
847 |
DetailRec.ExecutionAmount = ExecutionAmount;
|
|
848 |
DetailRec.AmountConfigRate = AmountConfigRate;
|
|
757 | 849 |
} |
758 | 850 |
DetailRec.CompanyCode = ConstructorCode; |
759 | 851 |
DetailRec.CompanyName = ConstructorName; |
... | ... | |
767 | 859 |
{ |
768 | 860 |
// ?L?[???Z?b?g |
769 | 861 |
DetailRec.ConstructionCode = m_ConstructionCode; |
770 |
DetailRec.GroupCount = (int)FrmConstructionBudget.DataGroup.PayrollExpenses;
|
|
862 |
DetailRec.GroupCount = GroupNo;
|
|
771 | 863 |
DetailRec.CompanyType = (int)CommonDefine.SearchLogDataType.Person; |
772 |
DetailRec.FirstString = frm.GetTitleConstructor; |
|
773 |
if (!BudgetDDB.InsertAction(DetailRec, false)) return false; |
|
774 |
} |
|
775 | 864 |
|
776 |
// ?o???X?V |
|
777 |
if (!BudgetSetExpenses(BudgetDDB, dBase, ExpensesList)) return false; |
|
778 |
|
|
779 |
return true; |
|
780 |
} |
|
781 |
catch (Exception ex) |
|
782 |
{ |
|
783 |
logger.ErrorFormat("?V?X?e???G???[?F{0}?F{1}", CommonMotions.GetMethodName(), ex.Message); |
|
784 |
return false; |
|
785 |
} |
|
786 |
} |
|
787 |
#endregion |
|
788 |
|
|
789 |
#region ?H???\?Z???F?f?[?^???S????Z?b?g |
|
790 |
/// <summary> |
|
791 |
/// ?H???\?Z???F?f?[?^???S????Z?b?g |
|
792 |
/// </summary> |
|
793 |
/// <param name="ApprovalNo"></param> |
|
794 |
/// <returns></returns> |
|
795 |
private bool BudgetDetailDataAssistantSet(IOConstructionBudgetDetail BudgetDDB, FrmConstructionBudget frm |
|
796 |
, int AssistantCode, string AssistantName, ConstructionBudget BudgetRec) |
|
797 |
{ |
|
798 |
try |
|
799 |
{ |
|
800 |
string strSQL = BudgetDDB.CreatePrimarykeyString(m_ConstructionCode, (int)FrmConstructionBudget.DataGroup.AssistantCosts); |
|
801 |
ConstructionBudgetDetail DetailRec = new ConstructionBudgetDetail(); |
|
802 |
// ?H???\?Z??????f?[?^?????????????O?????????s |
|
803 |
bool UpdateFlg = BudgetDDB.SelectAction(strSQL, ref DetailRec, false); |
|
804 |
|
|
805 |
// ???S????????????????????? |
|
806 |
if (DetailRec.CompanyCode == AssistantCode) return true; |
|
807 |
|
|
808 |
if (AssistantCode == 0) |
|
809 |
{ |
|
810 |
ClearConstructionBudgetDetailRec(ref DetailRec); |
|
811 |
} |
|
812 |
else |
|
813 |
{ |
|
814 |
double dBase = (int)CommonMotions.cnvUndecidedStringToDouble(m_DspCtrl[(int)DspCnt.OrdersDecisionPrice].Text); |
|
815 |
// ???S??????^ |
|
816 |
DetailRec.CompanyType = (int)CommonDefine.SearchLogDataType.Person; |
|
817 |
DetailRec.OrderDesiredAmount = CommonDefine.AssistantMonthryCost * BudgetRec.ConstructionTimes; |
|
818 |
DetailRec.ExecutionAmount = DetailRec.OrderDesiredAmount; |
|
819 |
DetailRec.AmountConfigRate = CommonMotions.cnvRound(DetailRec.ExecutionAmount / dBase * 100.0); |
|
820 |
} |
|
821 |
DetailRec.CompanyCode = AssistantCode; |
|
822 |
DetailRec.CompanyName = AssistantName; |
|
823 |
|
|
824 |
// ----- ?H???\?Z??????f?[?^?X?V |
|
825 |
if (UpdateFlg) |
|
826 |
{ |
|
827 |
if (!BudgetDDB.UpdateAction(strSQL, DetailRec, false)) return false; |
|
828 |
} |
|
829 |
else |
|
830 |
{ |
|
831 |
// ?L?[???Z?b?g |
|
832 |
DetailRec.ConstructionCode = m_ConstructionCode; |
|
833 |
DetailRec.GroupCount = (int)FrmConstructionBudget.DataGroup.AssistantCosts; |
|
834 |
DetailRec.CompanyType = (int)CommonDefine.SearchLogDataType.Person; |
|
835 |
DetailRec.FirstString = frm.GetTitleAssistant; |
|
865 |
frm.GetTitileParametar = GroupNo; |
他の形式にエクスポート: Unified diff