リビジョン 131
5月15日本番開始モジュール
tags/src_20170512/ProcessManagement/ProcessManagement/Forms/DataEntry/Request/SalesConfirm/FrmSalesConfirm.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.Threading.Tasks; |
|
9 |
using System.Windows.Forms; |
|
10 |
using System.Collections; |
|
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.DB.Core; |
|
20 |
using ProcessManagement.Forms.Master; |
|
21 |
using ProcessManagement.Forms.DataEntry; |
|
22 |
using ProcessManagement.Forms.CustomControls; |
|
23 |
using ProcessManagement.Forms.ControlsAction; |
|
24 |
using ProcessManagement.Forms.SubForms; |
|
25 |
using System.Reflection; |
|
26 |
|
|
27 |
/// <summary> |
|
28 |
/// 「売上確認」画面 |
|
29 |
/// </summary> |
|
30 |
namespace ProcessManagement.Forms.DataEntry |
|
31 |
{ |
|
32 |
public partial class FrmSalesConfirm : Form |
|
33 |
{ |
|
34 |
#region 使用定義 |
|
35 |
/// <summary> |
|
36 |
/// ロガー |
|
37 |
/// </summary> |
|
38 |
private static readonly log4net.ILog logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
|
39 |
#endregion |
|
40 |
|
|
41 |
#region 定数 |
|
42 |
/// <summary> |
|
43 |
/// 承認状態 |
|
44 |
/// </summary> |
|
45 |
public enum ApprovalStatus |
|
46 |
{ |
|
47 |
None = 0, |
|
48 |
InCharge, |
|
49 |
InApproval, |
|
50 |
Approved, |
|
51 |
} |
|
52 |
|
|
53 |
/// <summary> |
|
54 |
/// 合計行の見出し |
|
55 |
/// </summary> |
|
56 |
private enum TotalRows |
|
57 |
{ |
|
58 |
小計 = 1, |
|
59 |
入金金額, |
|
60 |
調整後金額, |
|
61 |
差額, |
|
62 |
} |
|
63 |
|
|
64 |
/// <summary> |
|
65 |
/// 表示カラム ※■は非表示セル |
|
66 |
/// </summary> |
|
67 |
private enum DispColumn |
|
68 |
{ |
|
69 |
RowType = 0, // ■編集状態 |
|
70 |
No, // No |
|
71 |
OrderersDivision, // ■発注先区分 |
|
72 |
OrderersCode, // ■発注者コード |
|
73 |
SeqNo, // ■連番 |
|
74 |
LineCount, // ■行番号 |
|
75 |
OrderersName, // 請求先名 |
|
76 |
DepositDate, // 入金日 |
|
77 |
DepositAmountCash, // 入金金額 (振込み) |
|
78 |
DepositAmountBill, // 入金金額 (手形) |
|
79 |
RequestNo, // ■請求No. |
|
80 |
OrderNo, // ■受付番号 |
|
81 |
ConstructionName, // 現場名 |
|
82 |
ConstructionName_Raw, // ■現場名 (DB登録値) |
|
83 |
PaymentSchedule, // 入金予定日 |
|
84 |
BillCreationDate, // 請求日 |
|
85 |
BillPrice, // 請求金額 (税抜) |
|
86 |
TaxPrice, // 請求金額 (消費税) |
|
87 |
DepositAmount, // 入金金額 |
|
88 |
DiscountAmount, // 値引金額 |
|
89 |
CnstrPrice, // 協力金 |
|
90 |
Fees, // 手数料 |
|
91 |
OtherAdjustments, // その他調整 |
|
92 |
CarryAmount, // 次回繰越 |
|
93 |
PersonName, // 担当者承認 |
|
94 |
PersonCode, // ■担当者コード |
|
95 |
PersonDate, // ■担当者日付 |
|
96 |
ApprovalName_1, // 承認者1承認 |
|
97 |
ApprovalCode_1, // ■承認者コード_1 |
|
98 |
ApprovalAuthority_1, // ■承認権限区分_1 |
|
99 |
ApprovalDate_1, // ■承認日付_1 |
|
100 |
ApprovalOrder_1, // ■承認順番_1 |
|
101 |
ApprovalName_2, // 承認者2承認 |
|
102 |
ApprovalCode_2, // ■承認者コード_2 |
|
103 |
ApprovalAuthority_2, // ■承認権限区分_2 |
|
104 |
ApprovalDate_2, // ■承認日付_2 |
|
105 |
ApprovalOrder_2, // ■承認順番_2 |
|
106 |
ApprovalName_3, // 承認者3承認 |
|
107 |
ApprovalCode_3, // ■承認者コード_3 |
|
108 |
ApprovalAuthority_3, // ■承認権限区分_3 |
|
109 |
ApprovalDate_3, // ■承認日付_3 |
|
110 |
ApprovalOrder_3, // ■承認順番_3 |
|
111 |
ApprovalName_4, // 承認者4承認 |
|
112 |
ApprovalCode_4, // ■承認者コード_4 |
|
113 |
ApprovalAuthority_4, // ■承認権限区分_4 |
|
114 |
ApprovalDate_4, // ■承認日付_4 |
|
115 |
ApprovalOrder_4, // ■承認順番_4 |
|
116 |
ApprovalName_5, // 承認者5承認 |
|
117 |
ApprovalCode_5, // ■承認者コード_5 |
|
118 |
ApprovalAuthority_5, // ■承認権限区分_5 |
|
119 |
ApprovalDate_5, // ■承認日付_5 |
|
120 |
ApprovalOrder_5, // ■承認順番_5 |
|
121 |
ApprovalName_6, // 承認者6承認 |
|
122 |
ApprovalCode_6, // ■承認者コード_6 |
|
123 |
ApprovalAuthority_6, // ■承認権限区分_6 |
|
124 |
ApprovalDate_6, // ■承認日付_6 |
|
125 |
ApprovalOrder_6, // ■承認順番_6 |
|
126 |
ApprovalName_7, // 承認者7承認 |
|
127 |
ApprovalCode_7, // ■承認者コード_7 |
|
128 |
ApprovalAuthority_7, // ■承認権限区分_7 |
|
129 |
ApprovalDate_7, // ■承認日付_7 |
|
130 |
ApprovalOrder_7, // ■承認順番_7 |
|
131 |
ApprovalName_8, // 承認者8承認 |
|
132 |
ApprovalCode_8, // ■承認者コード_8 |
|
133 |
ApprovalAuthority_8, // ■承認権限区分_8 |
|
134 |
ApprovalDate_8, // ■承認日付_8 |
|
135 |
ApprovalOrder_8, // ■承認順番_8 |
|
136 |
ApprovalName_9, // 承認者9承認 |
|
137 |
ApprovalCode_9, // ■承認者コード_9 |
|
138 |
ApprovalAuthority_9, // ■承認権限区分_9 |
|
139 |
ApprovalDate_9, // ■承認日付_9 |
|
140 |
ApprovalOrder_9, // ■承認順番_9 |
|
141 |
ApprovalName_10, // 承認者10承認 |
|
142 |
ApprovalCode_10, // ■承認者コード_10 |
|
143 |
ApprovalAuthority_10, // ■承認権限区分_10 |
|
144 |
ApprovalDate_10, // ■承認日付_10 |
|
145 |
ApprovalOrder_10, // ■承認順番_10 |
|
146 |
} |
|
147 |
|
|
148 |
/// <summary> |
|
149 |
/// 取得するデータ項目 |
|
150 |
/// </summary> |
|
151 |
private enum ClickGetData |
|
152 |
{ |
|
153 |
OrderersDivision = 0, |
|
154 |
OrderersCode, |
|
155 |
TargetDate, |
|
156 |
SeqNo, |
|
157 |
DepositDate, |
|
158 |
DepositAmountCash, |
|
159 |
DepositAmountBill, |
|
160 |
CorporateStatusName, |
|
161 |
CorporateStatusPoint, |
|
162 |
OrderersName1, |
|
163 |
OrderersName2, |
|
164 |
LineCount, |
|
165 |
RequestNo, |
|
166 |
OrderNo, |
|
167 |
DepositAmount, |
|
168 |
DiscountAmount, |
|
169 |
CnstrPrice, |
|
170 |
Fees, |
|
171 |
OtherAdjustments, |
|
172 |
CarryAmount, |
|
173 |
ApprovalPersonCode, |
|
174 |
ApprovalDate, |
|
175 |
ApprovalEndFlg, |
|
176 |
PersonName, |
|
177 |
DepartmentCode, |
|
178 |
BillCreationDate, |
|
179 |
BillPrice, |
|
180 |
TaxPrice, |
|
181 |
ConstructionCode, |
|
182 |
ConstructionPersonCode, |
|
183 |
ConstrSubPersonCode, |
|
184 |
ConstructionInstructor, |
|
185 |
DetailNo, |
|
186 |
DetailString, |
|
187 |
ApprovalPersonName1, |
|
188 |
ApprovalPerson1, |
|
189 |
ApprovalAuthority1, |
|
190 |
ApprovalDate1, |
|
191 |
ApprovalPersonName2, |
|
192 |
ApprovalPerson2, |
|
193 |
ApprovalAuthority2, |
|
194 |
ApprovalDate2, |
|
195 |
ApprovalPersonName3, |
|
196 |
ApprovalPerson3, |
|
197 |
ApprovalAuthority3, |
|
198 |
ApprovalDate3, |
|
199 |
ApprovalPersonName4, |
|
200 |
ApprovalPerson4, |
|
201 |
ApprovalAuthority4, |
|
202 |
ApprovalDate4, |
|
203 |
ApprovalPersonName5, |
|
204 |
ApprovalPerson5, |
|
205 |
ApprovalAuthority5, |
|
206 |
ApprovalDate5, |
|
207 |
ApprovalPersonName6, |
|
208 |
ApprovalPerson6, |
|
209 |
ApprovalAuthority6, |
|
210 |
ApprovalDate6, |
|
211 |
ApprovalPersonName7, |
|
212 |
ApprovalPerson7, |
|
213 |
ApprovalAuthority7, |
|
214 |
ApprovalDate7, |
|
215 |
ApprovalPersonName8, |
|
216 |
ApprovalPerson8, |
|
217 |
ApprovalAuthority8, |
|
218 |
ApprovalDate8, |
|
219 |
ApprovalPersonName9, |
|
220 |
ApprovalPerson9, |
|
221 |
ApprovalAuthority9, |
|
222 |
ApprovalDate9, |
|
223 |
ApprovalPersonName10, |
|
224 |
ApprovalPerson10, |
|
225 |
ApprovalAuthority10, |
|
226 |
ApprovalDate10 |
|
227 |
} |
|
228 |
|
|
229 |
/// <summary> |
|
230 |
/// 承認情報 |
|
231 |
/// </summary> |
|
232 |
private class ApproveData |
|
233 |
{ |
|
234 |
public int Key { get; set; } |
|
235 |
public string Value { get; set; } |
|
236 |
public int Order { get; set; } |
|
237 |
public int ApprovalAuthority { get; set; } |
|
238 |
} |
|
239 |
|
|
240 |
/// <summary> |
|
241 |
/// 入金請求先情報 |
|
242 |
/// </summary> |
|
243 |
private class DepositOrderer |
|
244 |
{ |
|
245 |
public bool Added = false; |
|
246 |
private bool deleted = false; |
|
247 |
public bool Deleted |
|
248 |
{ |
|
249 |
get { return deleted && Deposits.All(d => d.Deleted); } |
|
250 |
set |
|
251 |
{ |
|
252 |
deleted = value; |
|
253 |
foreach (var deposit in Deposits) |
|
254 |
{ |
|
255 |
deposit.Deleted = value; |
|
256 |
} |
|
257 |
} |
|
258 |
} |
|
259 |
public int No; |
|
260 |
public int OrderersDivision; |
|
261 |
public int OrderersCode; |
|
262 |
public string OrderersName; |
|
263 |
public List<Deposit> Deposits = new List<Deposit>(); |
|
264 |
public List<Deposit> VisibleDeposits |
|
265 |
{ |
|
266 |
get { return Deposits.Where(d => !d.Deleted).ToList(); } |
|
267 |
} |
|
268 |
public List<DepositDetail> DepositDetails = new List<DepositDetail>(); |
|
269 |
public List<DepositDetail> VisibleDepositDetails |
|
270 |
{ |
|
271 |
get { return DepositDetails.Where(dd => dd.Visible && !dd.Deleted).ToList(); } |
|
272 |
} |
|
273 |
public int Size |
|
274 |
{ |
|
275 |
get { return Math.Max(Math.Max(VisibleDeposits.Count, VisibleDepositDetails.Count), 1); } |
|
276 |
} |
|
277 |
public Deposit FindDepositBySeqNo(int seqNo) |
|
278 |
{ |
|
279 |
return Deposits.Find(d => d.SeqNo == seqNo); |
|
280 |
} |
|
281 |
public DepositDetail FindDepositDetailByLineCount(int lineCount) |
|
282 |
{ |
|
283 |
return DepositDetails.Find(dd => dd.LineCount == lineCount); |
|
284 |
} |
|
285 |
public int GetNextSeqNo() |
|
286 |
{ |
|
287 |
if (Deposits.Count == 0) |
|
288 |
return 1; |
|
289 |
return Deposits.Max(d => d.SeqNo) + 1; |
|
290 |
} |
|
291 |
public int GetNextLineCount() |
|
292 |
{ |
|
293 |
if (DepositDetails.Count == 0) |
|
294 |
return 1; |
|
295 |
return DepositDetails.Max(dd => dd.LineCount) + 1; |
|
296 |
} |
|
297 |
public bool HasApprovedByStaff |
|
298 |
{ |
|
299 |
get |
|
300 |
{ |
|
301 |
if (DepositDetails.Count == 0) |
|
302 |
return false; |
|
303 |
return DepositDetails.Any(dd => dd.IsApprovedByStaff); |
|
304 |
} |
|
305 |
} |
|
306 |
public bool HasApprovedByApprover |
|
307 |
{ |
|
308 |
get |
|
309 |
{ |
|
310 |
if (DepositDetails.Count == 0) |
|
311 |
return false; |
|
312 |
return DepositDetails.Any(dd => dd.IsApprovedByApprover); |
|
313 |
} |
|
314 |
} |
|
315 |
public bool HasApprovedByLastApprover |
|
316 |
{ |
|
317 |
get |
|
318 |
{ |
|
319 |
if (DepositDetails.Count == 0) |
|
320 |
return false; |
|
321 |
return DepositDetails.Any(dd => dd.IsApprovedByLastApprover); |
|
322 |
} |
|
323 |
} |
|
324 |
} |
|
325 |
|
|
326 |
/// <summary> |
|
327 |
/// 入金情報 |
|
328 |
/// </summary> |
|
329 |
private class Deposit |
|
330 |
{ |
|
331 |
public bool Added = false; |
|
332 |
public bool Editted = false; |
|
333 |
public bool Deleted = false; |
|
334 |
public int SeqNo; |
|
335 |
public string DepositDate; |
|
336 |
public long? DepositAmountCash; |
|
337 |
public long? DepositAmountBill; |
|
338 |
public bool CanRemove |
|
339 |
{ |
|
340 |
get |
|
341 |
{ |
|
342 |
// 追加行かつ未入力の場合 |
|
343 |
return Added |
|
344 |
&& string.IsNullOrEmpty(DepositDate) |
|
345 |
&& !DepositAmountCash.HasValue |
|
346 |
&& !DepositAmountBill.HasValue; |
|
347 |
} |
|
348 |
} |
|
349 |
} |
|
350 |
|
|
351 |
/// <summary> |
|
352 |
/// 入金明細情報 |
|
353 |
/// </summary> |
|
354 |
private class DepositDetail |
|
355 |
{ |
|
356 |
public bool Added = false; |
|
357 |
public bool Editted = false; |
|
358 |
public bool Deleted = false; |
|
359 |
public bool Visible; |
|
360 |
public int SeqNo; |
|
361 |
public int LineCount; |
|
362 |
public int RequestNo; |
|
363 |
public int OrderNo; |
|
364 |
public string ConstructionName; |
|
365 |
public string ConstructionNameRow; |
|
366 |
public string BillCreationDate; |
|
367 |
public long BillPrice; |
|
368 |
public long TaxPrice; |
|
369 |
public long DepositAmount; |
|
370 |
public long DiscountAmount; |
|
371 |
public long CnstrPrice; |
|
372 |
public long Fees; |
|
373 |
public long OtherAdjustments; |
|
374 |
public long CarryAmount; |
|
375 |
public string ApprovalPersonName; |
|
376 |
public int ApprovalPersonCode; |
|
377 |
public string ApprovalDate; |
|
378 |
public int ApprovalEndFlg; |
|
379 |
public int DepartmentCode; |
|
380 |
public int ConstructionCode; |
|
381 |
public int ConstructionPersonCode; |
|
382 |
public int ConstrSubPersonCode; |
|
383 |
public int ConstructionInstructor; |
|
384 |
public ApprovalStatus Status = ApprovalStatus.None; |
|
385 |
public bool UpperApprovalInUser = false; |
|
386 |
public List<DepositApproval> DepositApprovals = new List<DepositApproval>(); |
|
387 |
public bool IsApprovedByStaff |
|
388 |
{ |
|
389 |
get { return !string.IsNullOrEmpty(ApprovalDate); } |
|
390 |
} |
|
391 |
public bool IsApprovedByApprover |
|
392 |
{ |
|
393 |
get |
|
394 |
{ |
|
395 |
if (DepositApprovals.Count == 0) |
|
396 |
return false; |
|
397 |
return DepositApprovals.First().ApprovalDate != ""; |
|
398 |
} |
|
399 |
} |
|
400 |
public bool IsApprovedByLastApprover |
|
401 |
{ |
|
402 |
get |
|
403 |
{ |
|
404 |
if (DepositApprovals.Count == 0) |
|
405 |
return false; |
|
406 |
return DepositApprovals.Last().ApprovalDate != ""; |
|
407 |
} |
|
408 |
} |
|
409 |
} |
|
410 |
|
|
411 |
/// <summary> |
|
412 |
/// 入金確認承認情報 |
|
413 |
/// </summary> |
|
414 |
private class DepositApproval |
|
415 |
{ |
|
416 |
public bool Added = false; |
|
417 |
public bool Editted = false; |
|
418 |
public int ApprovalNo; |
|
419 |
public int ApprovalPerson; |
|
420 |
public string ApprovalPersonName; |
|
421 |
public int ApprovalAuthority; |
|
422 |
public string ApprovalDate; |
|
423 |
} |
|
424 |
|
|
425 |
private List<DepositOrderer> depositOrderers; |
|
426 |
|
|
427 |
///// <summary>編集前のセルの内容</summary> |
|
428 |
//private string oldCellValue = ""; |
|
429 |
|
|
430 |
/// <summary>データ表示の対象営業期</summary> |
|
431 |
private int m_Select_TargetBusinessPeriod = 0; |
|
432 |
|
|
433 |
/// <summary>データ表示の対象月</summary> |
|
434 |
private int m_Select_TargetDate = 0; |
|
435 |
|
|
436 |
/// <summary>データ表示の対象部署</summary> |
|
437 |
private int m_Select_TargetDepartment = 0; |
|
438 |
|
|
439 |
/// <summary>データ表示の対象担当者</summary> |
|
440 |
private int m_Select_TargetPerson = 0; |
|
441 |
|
|
442 |
/// <summary> ユーザー情報</summary> |
|
443 |
private ClsSecurityPermission.UserInfo m_UserInfo = new ClsSecurityPermission.UserInfo() |
|
444 |
{ |
|
445 |
m_Type = CommonDefine.SecurityRankPos.NormalAuthority, |
|
446 |
m_GeneralAffairsFlg = 0, |
|
447 |
m_SecRange = ClsSecurityPermission.SecRangeType.InCharge |
|
448 |
}; |
|
449 |
|
|
450 |
/// <summary> 部署コンボボックス用リスト</summary> |
|
451 |
public List<KeyValuePair<int, String>> listDepartment = new List<KeyValuePair<int, String>>(); |
|
452 |
|
|
453 |
/// <summary> 担当者コンボボックス用リスト</summary> |
|
454 |
public List<KeyValuePair<int, String>> listPerson = new List<KeyValuePair<int, String>>(); |
|
455 |
|
|
456 |
#endregion |
|
457 |
|
|
458 |
#region コンストラクタ |
|
459 |
/// <summary> |
|
460 |
/// コンストラクタ |
|
461 |
/// </summary> |
|
462 |
public FrmSalesConfirm() |
|
463 |
{ |
|
464 |
InitializeComponent(); |
|
465 |
} |
|
466 |
#endregion |
|
467 |
|
|
468 |
#region フォームロード |
|
469 |
/// <summary> |
|
470 |
/// フォームロードイベント |
|
471 |
/// </summary> |
|
472 |
/// <param name="sender"></param> |
|
473 |
/// <param name="e"></param> |
|
474 |
private void FrmSalesConfirm_Load(object sender, EventArgs e) |
|
475 |
{ |
|
476 |
try |
|
477 |
{ |
|
478 |
|
|
479 |
////////////////////////////////////////////////////////////////////////////// |
|
480 |
// ■画面表示時のイベントを停止 |
|
481 |
////////////////////////////////////////////////////////////////////////////// |
|
482 |
|
|
483 |
radioButton1.CheckedChanged -= new System.EventHandler(this.radioButton1_CheckedChanged); |
|
484 |
comboBox1.SelectedIndexChanged -= new System.EventHandler(this.comboBox1_SelectedIndexChanged); |
|
485 |
comboBox2.SelectedIndexChanged -= new System.EventHandler(this.comboBox2_SelectedIndexChanged); |
|
486 |
comboBox3.SelectedIndexChanged -= new System.EventHandler(this.comboBox3_SelectedIndexChanged); |
|
487 |
numericUpDown2.ValueChanged -= new System.EventHandler(this.numericUpDown2_ValueChanged); |
|
488 |
|
|
489 |
|
|
490 |
/////////////////////////////////////////////////////////////////////////// |
|
491 |
// ■表示条件設定 |
|
492 |
/////////////////////////////////////////////////////////////////////////// |
|
493 |
|
|
494 |
// 営業期 |
|
495 |
int minval = 0; |
|
496 |
int maxval = 0; |
|
497 |
|
|
498 |
CommonMotions.GetPeriodYear(ref minval, ref maxval); |
|
499 |
|
|
500 |
// 最大営業期 |
|
501 |
numericUpDown2.Maximum = maxval; |
|
502 |
// 最小営業期 |
|
503 |
numericUpDown2.Minimum = minval; |
|
504 |
// 初期値は現在の営業期 |
|
505 |
numericUpDown2.Value = CommonMotions.SystemMasterData.BusinessPeriod; |
|
506 |
|
|
507 |
|
|
508 |
// 対象月 |
|
509 |
comboBox1.Items.Add(" "); |
|
510 |
|
|
511 |
for (int iMonthCount = 1; iMonthCount < 13; iMonthCount++) |
|
512 |
{ |
|
513 |
comboBox1.Items.Add(iMonthCount); |
|
514 |
} |
|
515 |
comboBox1.SelectedIndex = 0; |
|
516 |
|
|
517 |
// 部署 |
|
518 |
this.listDepartment = getDepartmentList(0); |
|
519 |
|
|
520 |
comboBox2.DataSource = listDepartment; |
|
521 |
comboBox2.SelectedIndex = 0; |
|
522 |
|
|
523 |
// 担当者 |
|
524 |
this.listPerson = getPersonList(0); |
|
525 |
|
|
526 |
comboBox3.DataSource = listPerson; |
|
527 |
comboBox3.SelectedIndex = 0; |
|
528 |
|
|
529 |
// イベントを停止させているため、強制的に非活性にする |
|
530 |
comboBox1.Enabled = false; |
|
531 |
// 初期フォーカスはラジオボタン(通年) |
|
532 |
radioButton1.Checked = true; |
|
533 |
|
|
534 |
/////////////////////////////////////////////////////////////////////////// |
|
535 |
// ■一覧表示設定 |
|
536 |
/////////////////////////////////////////////////////////////////////////// |
|
537 |
|
|
538 |
// ユーザ権限設定 |
|
539 |
ClsSecurityPermission.SetUserType(m_UserInfo); |
|
540 |
|
|
541 |
// ちらつきを抑えるため、ダブルバッファリングを有効にする。 |
|
542 |
dgvMaster.GetType().InvokeMember("DoubleBuffered", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty, |
|
543 |
null, dgvMaster, new object[] { true }); |
|
544 |
|
|
545 |
// 一覧のヘッダ色を設定する |
|
546 |
SetGridHeaderColor(); |
|
547 |
|
|
548 |
// 一覧表示情報を取得する |
|
549 |
DisplayData(); |
|
550 |
|
|
551 |
|
|
552 |
} |
|
553 |
catch (Exception ex) |
|
554 |
{ |
|
555 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
556 |
} |
|
557 |
finally |
|
558 |
{ |
|
559 |
radioButton1.CheckedChanged += new System.EventHandler(this.radioButton1_CheckedChanged); |
|
560 |
comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged); |
|
561 |
comboBox2.SelectedIndexChanged += new System.EventHandler(this.comboBox2_SelectedIndexChanged); |
|
562 |
comboBox3.SelectedIndexChanged += new System.EventHandler(this.comboBox3_SelectedIndexChanged); |
|
563 |
numericUpDown2.ValueChanged += new System.EventHandler(this.numericUpDown2_ValueChanged); |
|
564 |
} |
|
565 |
} |
|
566 |
#endregion |
|
567 |
|
|
568 |
#region フォームクローズ |
|
569 |
/// <summary> |
|
570 |
/// フォームクローズイベント |
|
571 |
/// </summary> |
|
572 |
/// <param name="sender"></param> |
|
573 |
/// <param name="e"></param> |
|
574 |
private void FrmSalesConfirm_FormClosing(object sender, FormClosingEventArgs e) |
|
575 |
{ |
|
576 |
try |
|
577 |
{ |
|
578 |
//if (m_CloseingProcessOff) return; |
|
579 |
|
|
580 |
//if (isDirty) |
|
581 |
//{ |
|
582 |
// if (MessageBox.Show("データに変更があります、登録せずに終了してよろしいですか?。", "終了確認" |
|
583 |
// , MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) |
|
584 |
// { |
|
585 |
// e.Cancel = true; |
|
586 |
// return; |
|
587 |
// } |
|
588 |
//} |
|
589 |
|
|
590 |
// 前プロセスに戻る |
|
591 |
ClsExcute.BackProcess(); |
|
592 |
} |
|
593 |
catch (Exception ex) |
|
594 |
{ |
|
595 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
596 |
} |
|
597 |
} |
|
598 |
#endregion |
|
599 |
|
|
600 |
#region 部署情報取得 |
|
601 |
/// <summary> |
|
602 |
/// 部署情報取得 |
|
603 |
/// </summary> |
|
604 |
/// <param name="sender"></param> |
|
605 |
/// <param name="e"></param> |
|
606 |
private List<KeyValuePair<int, String>> getDepartmentList(int iPersonCode) |
|
607 |
{ |
|
608 |
var listDepartment = new List<KeyValuePair<int, String>>(); |
|
609 |
|
|
610 |
listDepartment.Add(new KeyValuePair<int, String>(0, "すべて")); |
|
611 |
|
|
612 |
var listResultSQL = new ArrayList(); |
|
613 |
listResultSQL = getDepartmentListQuery(iPersonCode); |
|
614 |
|
|
615 |
foreach (object[] result in listResultSQL) |
|
616 |
{ |
|
617 |
int iDepartmentCode = CommonMotions.cnvInt(result[0]); |
|
618 |
String strDepartmentName = CommonMotions.cnvString(result[1]); |
|
619 |
listDepartment.Add(new KeyValuePair<int, String>(iDepartmentCode, strDepartmentName)); |
|
620 |
} |
|
621 |
|
|
622 |
return listDepartment; |
|
623 |
|
|
624 |
} |
|
625 |
|
|
626 |
/// <summary> |
|
627 |
/// 部署情報取得SQL実行 |
|
628 |
/// </summary> |
|
629 |
/// <param name="sender"></param> |
|
630 |
/// <param name="e"></param> |
|
631 |
private ArrayList getDepartmentListQuery(int iPersonCode) |
|
632 |
{ |
|
633 |
var depDb = new IODepositData(); |
|
634 |
|
|
635 |
try |
|
636 |
{ |
|
637 |
var sql = new StringBuilder(); |
|
638 |
|
|
639 |
sql.Append("SELECT "); |
|
640 |
sql.Append("DEPM.DepartmentCode "); // 部署マスタ.部署コード |
|
641 |
sql.Append(",DEPM.DepartmentString "); // 部署マスタ.部署名 |
|
642 |
sql.Append("FROM "); |
|
643 |
sql.Append("departmentmaster DEPM "); // 部署マスタ |
|
644 |
|
|
645 |
///////////////////////////////////////////////////////////////////////////// |
|
646 |
// 検索条件(動的)START |
|
647 |
///////////////////////////////////////////////////////////////////////////// |
|
648 |
if (!iPersonCode.Equals(0)) |
|
649 |
{ |
|
650 |
sql.Append("INNER JOIN personinchargemaster PERIM "); // 担当者マスタ |
|
651 |
sql.Append("ON DEPM.DepartmentCode = PERIM.DepartmentCode "); // 担当者マスタ.部署コード = 部署マスタ.部署コード |
|
652 |
sql.AppendFormat("AND PERIM.PersonCode = {0} ", iPersonCode); // 担当者マスタ.担当者コード = 画面.担当者コード(隠し項目) |
|
653 |
} |
|
654 |
///////////////////////////////////////////////////////////////////////////// |
|
655 |
// 検索条件(動的)END |
|
656 |
///////////////////////////////////////////////////////////////////////////// |
|
657 |
|
|
658 |
sql.Append("WHERE "); |
|
659 |
sql.Append("DEPM.DeleteFlg = 0 "); // 部署マスタ.削除フラグ = 0 |
|
660 |
sql.Append("ORDER BY "); |
|
661 |
sql.Append("DEPM.DisplayOrder ASC"); // 部署マスタ.表示順(昇順) |
|
662 |
|
|
663 |
var data = new ArrayList(); |
|
664 |
if (!depDb.ExecuteReader(sql.ToString(), ref data)) return new ArrayList(); |
|
665 |
return data; |
|
666 |
} |
|
667 |
catch (Exception ex) |
|
668 |
{ |
|
669 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
670 |
return new ArrayList(); |
|
671 |
} |
|
672 |
finally |
|
673 |
{ |
|
674 |
depDb.close(); |
|
675 |
depDb = null; |
|
676 |
} |
|
677 |
|
|
678 |
} |
|
679 |
#endregion |
|
680 |
|
|
681 |
#region 担当者情報取得 |
|
682 |
/// <summary> |
|
683 |
/// 担当者情報取得 |
|
684 |
/// </summary> |
|
685 |
/// <param name="sender"></param> |
|
686 |
/// <param name="e"></param> |
|
687 |
private List<KeyValuePair<int, String>> getPersonList(int iDepartmentCode) |
|
688 |
{ |
|
689 |
var listPerson = new List<KeyValuePair<int, String>>(); |
|
690 |
|
|
691 |
listPerson.Add(new KeyValuePair<int, String>(0, "すべて")); |
|
692 |
|
|
693 |
var listResultSQL = new ArrayList(); |
|
694 |
listResultSQL = getPersonListQuery(iDepartmentCode); |
|
695 |
|
|
696 |
foreach (object[] result in listResultSQL) |
|
697 |
{ |
|
698 |
int iResultPersonCode = CommonMotions.cnvInt(result[0]); |
|
699 |
String strResultPersonName = CommonMotions.cnvString(result[1]); |
|
700 |
listPerson.Add(new KeyValuePair<int, String>(iResultPersonCode, strResultPersonName)); |
|
701 |
} |
|
702 |
|
|
703 |
return listPerson; |
|
704 |
|
|
705 |
} |
|
706 |
|
|
707 |
/// <summary> |
|
708 |
/// 担当者情報取得SQL実行 |
|
709 |
/// </summary> |
|
710 |
/// <param name="sender"></param> |
|
711 |
/// <param name="e"></param> |
|
712 |
private ArrayList getPersonListQuery(int iDepartmentCode) |
|
713 |
{ |
|
714 |
var depDb = new IODepositData(); |
|
715 |
|
|
716 |
try |
|
717 |
{ |
|
718 |
var sql = new StringBuilder(); |
|
719 |
|
|
720 |
sql.Append("SELECT "); |
|
721 |
sql.Append("PERIM.PersonCode "); // 担当者マスタ.担当者コード |
|
722 |
sql.Append(",PERIM.PersonName "); // 担当者マスタ.担当者名 |
|
723 |
sql.Append("FROM "); |
|
724 |
sql.Append("personinchargemaster PERIM "); // 担当者マスタ |
|
725 |
sql.Append("WHERE "); |
|
726 |
sql.Append("PERIM.DeleteFlg = 0 "); // 部署マスタ.削除フラグ = 0 |
|
727 |
|
|
728 |
///////////////////////////////////////////////////////////////////////////// |
|
729 |
// 検索条件(動的)START |
|
730 |
///////////////////////////////////////////////////////////////////////////// |
|
731 |
if (!iDepartmentCode.Equals(0)) |
|
732 |
{ |
|
733 |
sql.AppendFormat("AND PERIM.DepartmentCode = {0} ", iDepartmentCode); // 担当者マスタ.担当者コード = 画面.部署コード(隠し項目) |
|
734 |
} |
|
735 |
///////////////////////////////////////////////////////////////////////////// |
|
736 |
// 検索条件(動的)END |
|
737 |
///////////////////////////////////////////////////////////////////////////// |
|
738 |
|
|
739 |
sql.Append("ORDER BY "); |
|
740 |
sql.Append("PERIM.DisplayOrder ASC"); // 部署マスタ.表示順(昇順) |
|
741 |
|
|
742 |
var data = new ArrayList(); |
|
743 |
if (!depDb.ExecuteReader(sql.ToString(), ref data)) return new ArrayList(); |
|
744 |
return data; |
|
745 |
} |
|
746 |
catch (Exception ex) |
|
747 |
{ |
|
748 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
749 |
return new ArrayList(); |
|
750 |
} |
|
751 |
finally |
|
752 |
{ |
|
753 |
depDb.close(); |
|
754 |
depDb = null; |
|
755 |
} |
|
756 |
|
|
757 |
} |
|
758 |
#endregion |
|
759 |
|
|
760 |
#region 入金請求先一覧表示 |
|
761 |
/// <summary> |
|
762 |
/// データを表示する。 |
|
763 |
/// </summary> |
|
764 |
private void DisplayData() |
|
765 |
{ |
|
766 |
try |
|
767 |
{ |
|
768 |
/////////////////////////////////////////////////////////////////////////////////////// |
|
769 |
// 表示条件の取得 |
|
770 |
/////////////////////////////////////////////////////////////////////////////////////// |
|
771 |
|
|
772 |
// 営業期 |
|
773 |
m_Select_TargetBusinessPeriod = CommonMotions.cnvInt(numericUpDown2.Value); |
|
774 |
|
|
775 |
// 対象月(月指定が選択されているかつ空白以外の場合のみ) |
|
776 |
if (radioButton2.Checked && !CommonMotions.cnvInt(comboBox1.SelectedItem).Equals(" ")) |
|
777 |
{ |
|
778 |
m_Select_TargetDate = CommonMotions.cnvInt(comboBox1.SelectedItem); |
|
779 |
} |
|
780 |
else |
|
781 |
{ |
|
782 |
m_Select_TargetDate = 0; |
|
783 |
} |
|
784 |
|
|
785 |
// 部署 |
|
786 |
m_Select_TargetDepartment = CommonMotions.cnvInt(comboBox2.SelectedValue); |
|
787 |
|
|
788 |
// 担当者 |
|
789 |
m_Select_TargetPerson = CommonMotions.cnvInt(comboBox3.SelectedValue); ; |
|
790 |
|
|
791 |
/////////////////////////////////////////////////////////////////////////////////////////// |
|
792 |
// データの取得 |
|
793 |
/////////////////////////////////////////////////////////////////////////////////////////// |
|
794 |
|
|
795 |
depositOrderers = new List<DepositOrderer>(); |
|
796 |
dgvMaster.Rows.Clear(); |
|
797 |
|
|
798 |
depositOrderers = SelectDepositOrderers(); |
|
799 |
|
|
800 |
// 請求先単位で設定を行う。 |
|
801 |
dgvMaster.SuspendLayout(); |
|
802 |
for (var i = (int)DispColumn.ApprovalName_1; i <= (int)DispColumn.ApprovalName_10; i += 5) |
|
803 |
dgvMaster.Columns[i].Visible = false; |
|
804 |
foreach (var deposit in depositOrderers) |
|
805 |
{ |
|
806 |
AddDepositOrdererRows(deposit, dgvMaster.RowCount); |
|
807 |
} |
|
808 |
} |
|
809 |
catch (Exception ex) |
|
810 |
{ |
|
811 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
812 |
} |
|
813 |
finally |
|
814 |
{ |
|
815 |
dgvMaster.ResumeLayout(); |
|
816 |
if (dgvMaster.Rows.Count > 0) |
|
817 |
{ |
|
818 |
dgvMaster.FirstDisplayedScrollingRowIndex = 0; |
|
819 |
dgvMaster.FirstDisplayedScrollingColumnIndex = 1; |
|
820 |
dgvMaster.CurrentCell = dgvMaster[1, 0]; |
|
821 |
} |
|
822 |
} |
|
823 |
} |
|
824 |
#endregion |
|
825 |
|
|
826 |
#region 入金請求先一覧作成 |
|
827 |
#region 入金請求先一覧作成 |
|
828 |
/// <summary> |
|
829 |
/// 入金請求先一覧を取得する。 |
|
830 |
/// </summary> |
|
831 |
/// <returns></returns> |
|
832 |
private List<DepositOrderer> SelectDepositOrderers() |
|
833 |
{ |
|
834 |
var depositData = SelectDepositDataAll().OfType<object[]>() |
|
835 |
.GroupBy(d => |
|
836 |
{ |
|
837 |
return string.Format("{0} {1}", |
|
838 |
CommonMotions.cnvInt(d[(int)ClickGetData.OrderersDivision]), |
|
839 |
CommonMotions.cnvInt(d[(int)ClickGetData.OrderersCode])); |
|
840 |
}); |
|
841 |
var data = new List<DepositOrderer>(); |
|
842 |
var no = 1; |
|
843 |
foreach (var deposits in depositData) |
|
844 |
{ |
|
845 |
var orderer = deposits.First(); |
|
846 |
// 請求先情報 |
|
847 |
var o = new DepositOrderer(); |
|
848 |
o.OrderersDivision = CommonMotions.cnvInt(orderer[(int)ClickGetData.OrderersDivision]); |
|
849 |
o.OrderersCode = CommonMotions.cnvInt(orderer[(int)ClickGetData.OrderersCode]); |
|
850 |
o.OrderersName = ToOrdererName(CommonMotions.cnvInt(orderer[(int)ClickGetData.CorporateStatusPoint]), |
|
851 |
CommonMotions.cnvString(orderer[(int)ClickGetData.CorporateStatusName]), |
|
852 |
CommonMotions.cnvString(orderer[(int)ClickGetData.OrderersName1]), |
|
853 |
CommonMotions.cnvString(orderer[(int)ClickGetData.OrderersName2])); |
|
854 |
// 表示権限がない場合は次へ |
|
855 |
if (!CheckOrdererPermission(o)) |
|
856 |
{ |
|
857 |
continue; |
|
858 |
} |
|
859 |
o.No = no; |
|
860 |
no++; |
|
861 |
o.Deposits = new List<Deposit>(); |
|
862 |
o.DepositDetails = new List<DepositDetail>(); |
|
863 |
// 入金データ情報 |
|
864 |
foreach (var deposit in deposits) |
|
865 |
{ |
|
866 |
var d = new Deposit(); |
|
867 |
d.SeqNo = CommonMotions.cnvInt(deposit[(int)ClickGetData.SeqNo]); |
|
868 |
d.DepositDate = CommonMotions.cnvString(deposit[(int)ClickGetData.DepositDate]); |
|
869 |
d.DepositAmountCash = CommonMotions.cnvInt(deposit[(int)ClickGetData.DepositAmountCash]); |
|
870 |
d.DepositAmountBill = CommonMotions.cnvInt(deposit[(int)ClickGetData.DepositAmountBill]); |
|
871 |
o.Deposits.Add(d); |
|
872 |
} |
|
873 |
// 入金明細データ |
|
874 |
var details = SelectDepositDetailData(o.OrderersDivision, o.OrderersCode).OfType<object[]>(); |
|
875 |
foreach (var detail in details) |
|
876 |
{ |
|
877 |
var dd = new DepositDetail(); |
|
878 |
dd.SeqNo = CommonMotions.cnvInt(detail[(int)ClickGetData.SeqNo]); |
|
879 |
dd.LineCount = CommonMotions.cnvInt(detail[(int)ClickGetData.LineCount]); |
|
880 |
dd.RequestNo = CommonMotions.cnvInt(detail[(int)ClickGetData.RequestNo]); |
|
881 |
dd.OrderNo = CommonMotions.cnvInt(detail[(int)ClickGetData.OrderNo]); |
|
882 |
dd.ConstructionNameRow = CommonMotions.cnvString(detail[(int)ClickGetData.DetailString]); |
|
883 |
dd.ConstructionName = dd.ConstructionNameRow; |
|
884 |
if (dd.OrderNo > 1) |
|
885 |
{ |
|
886 |
dd.ConstructionName += "(" + dd.OrderNo + "回目)"; |
|
887 |
} |
|
888 |
// 入金予定日未実装 |
|
889 |
dd.BillCreationDate = CommonMotions.cnvString(detail[(int)ClickGetData.BillCreationDate]); |
|
890 |
dd.BillPrice = CommonMotions.cnvLong(detail[(int)ClickGetData.BillPrice]); |
|
891 |
dd.TaxPrice = CommonMotions.cnvLong(detail[(int)ClickGetData.TaxPrice]); |
|
892 |
dd.DepositAmount = CommonMotions.cnvLong(detail[(int)ClickGetData.DepositAmount]); |
|
893 |
dd.DiscountAmount = CommonMotions.cnvLong(detail[(int)ClickGetData.DiscountAmount]); |
|
894 |
dd.CnstrPrice = CommonMotions.cnvLong(detail[(int)ClickGetData.CnstrPrice]); |
|
895 |
dd.Fees = CommonMotions.cnvLong(detail[(int)ClickGetData.Fees]); |
|
896 |
dd.OtherAdjustments = CommonMotions.cnvLong(detail[(int)ClickGetData.OtherAdjustments]); |
|
897 |
dd.CarryAmount = CommonMotions.cnvLong(detail[(int)ClickGetData.CarryAmount]); |
|
898 |
dd.ApprovalPersonCode = CommonMotions.cnvInt(detail[(int)ClickGetData.ApprovalPersonCode]); |
|
899 |
dd.ApprovalEndFlg = CommonMotions.cnvInt(detail[(int)ClickGetData.ApprovalEndFlg]); |
|
900 |
dd.ApprovalPersonName = CommonMotions.cnvString(detail[(int)ClickGetData.PersonName]); |
|
901 |
dd.DepartmentCode = CommonMotions.cnvInt(detail[(int)ClickGetData.DepartmentCode]); |
|
902 |
dd.ConstructionCode = CommonMotions.cnvInt(detail[(int)ClickGetData.ConstructionCode]); |
|
903 |
dd.ConstructionPersonCode = CommonMotions.cnvInt(detail[(int)ClickGetData.ConstructionPersonCode]); |
|
904 |
dd.ConstrSubPersonCode = CommonMotions.cnvInt(detail[(int)ClickGetData.ConstrSubPersonCode]); |
|
905 |
dd.ConstructionInstructor = CommonMotions.cnvInt(detail[(int)ClickGetData.ConstructionInstructor]); |
|
906 |
dd.DepositApprovals = new List<DepositApproval>(); |
|
907 |
dd.Visible = CheckPermission(dd.DepartmentCode, dd.ConstructionPersonCode, dd.ConstrSubPersonCode, dd.ConstructionInstructor); |
|
908 |
dd.ApprovalDate = ""; |
|
909 |
if (CommonMotions.cnvString(detail[(int)ClickGetData.ApprovalDate]) != "0001-01-01") |
|
910 |
dd.ApprovalDate = CommonMotions.cnvString(detail[(int)ClickGetData.ApprovalDate]); |
|
911 |
// 担当者承認済みの場合 |
|
912 |
if (dd.IsApprovedByStaff) |
|
913 |
{ |
|
914 |
var depositApprovals = new List<DepositApprovalInfo>(); |
|
915 |
if (!SelectApprove(o.OrderersDivision, o.OrderersCode, dd.SeqNo, dd.LineCount, ref depositApprovals)) |
|
916 |
return null; |
|
917 |
var detectApproval = false; |
|
918 |
var detectNonApproval = false; |
|
919 |
var upperApprovalInUser = false; |
|
920 |
foreach (var appInfo in depositApprovals) |
|
921 |
{ |
|
922 |
var da = new DepositApproval() |
|
923 |
{ |
|
924 |
ApprovalNo = appInfo.ApprovalNo, |
|
925 |
ApprovalPersonName = appInfo.ApprovalPersonName, |
|
926 |
ApprovalPerson = appInfo.ApprovalPerson, |
|
927 |
ApprovalAuthority = appInfo.ApprovalAuthority, |
|
928 |
ApprovalDate = "", |
|
929 |
}; |
|
930 |
if (appInfo.ApprovalDate != DateTime.MinValue) |
|
931 |
da.ApprovalDate = appInfo.ApprovalDate.ToString("yyyy-MM-dd"); |
|
932 |
dd.DepositApprovals.Add(da); |
|
933 |
} |
|
934 |
// 承認状態を設定 |
|
935 |
if (!detectApproval) |
|
936 |
dd.Status = ApprovalStatus.InCharge; |
|
937 |
else if (detectNonApproval) |
|
938 |
dd.Status = ApprovalStatus.InApproval; |
|
939 |
else |
|
940 |
dd.Status = ApprovalStatus.Approved; |
|
941 |
dd.UpperApprovalInUser = upperApprovalInUser; |
|
942 |
} |
|
943 |
// 担当者未承認 |
|
944 |
else |
|
945 |
{ |
|
946 |
var defaultApproves = new List<ApproveData>(); |
|
947 |
if (!SelectDefaultApprove(dd.DepartmentCode, ref defaultApproves)) |
|
948 |
return null; |
|
949 |
foreach (var approve in defaultApproves) |
|
950 |
{ |
|
951 |
var da = new DepositApproval() |
|
952 |
{ |
|
953 |
Added = true, |
|
954 |
ApprovalPersonName = approve.Value, |
|
955 |
ApprovalPerson = approve.Key, |
|
956 |
ApprovalDate = "", |
|
957 |
ApprovalNo = approve.Order, |
|
958 |
}; |
|
959 |
dd.DepositApprovals.Add(da); |
|
960 |
} |
|
961 |
} |
|
962 |
o.DepositDetails.Add(dd); |
|
963 |
} |
|
964 |
data.Add(o); |
|
965 |
} |
|
966 |
return data; |
|
967 |
} |
|
968 |
#endregion |
|
969 |
|
|
970 |
#region 業者行を追加する |
|
971 |
/// <summary> |
|
972 |
/// 業者行を追加する。 |
|
973 |
/// </summary> |
|
974 |
/// <param name="depositOrderer"></param> |
|
975 |
/// <param name="position"></param> |
|
976 |
private void AddDepositOrdererRows(DepositOrderer depositOrderer, int position) |
|
977 |
{ |
|
978 |
try |
|
979 |
{ |
|
980 |
if (depositOrderer.Deleted) |
|
981 |
return; |
|
982 |
// 明細行を作成 |
|
983 |
dgvMaster.Rows.Insert(position, depositOrderer.Size); |
|
984 |
// いったんすべての行をReadOnlyにしておく |
|
985 |
for (var i = position; i < position + depositOrderer.Size; i++) |
|
986 |
dgvMaster.Rows[i].ReadOnly = true; |
|
987 |
var ordererRow = dgvMaster.Rows[position]; |
|
988 |
// 請求先情報の表示 |
|
989 |
ordererRow.Cells[(int)DispColumn.No].Value = depositOrderer.No; |
|
990 |
ordererRow.Cells[(int)DispColumn.OrderersDivision].Value = depositOrderer.OrderersDivision; |
|
991 |
ordererRow.Cells[(int)DispColumn.OrderersCode].Value = depositOrderer.OrderersCode; |
|
992 |
ordererRow.Cells[(int)DispColumn.OrderersName].Value = depositOrderer.OrderersName; |
|
993 |
|
|
994 |
// 入金情報の表示 |
|
995 |
var index = 0; |
|
996 |
foreach (var deposit in depositOrderer.VisibleDeposits) |
|
997 |
{ |
|
998 |
var row = dgvMaster.Rows[position + index]; |
|
999 |
row.Cells[(int)DispColumn.OrderersDivision].Value = depositOrderer.OrderersDivision; |
|
1000 |
row.Cells[(int)DispColumn.OrderersCode].Value = depositOrderer.OrderersCode; |
|
1001 |
row.Cells[(int)DispColumn.SeqNo].Value = deposit.SeqNo; |
|
1002 |
row.Cells[(int)DispColumn.DepositDate].Value = deposit.DepositDate; |
|
1003 |
if (deposit.DepositAmountCash.HasValue) |
|
1004 |
SetPrice(row.Cells, (int)DispColumn.DepositAmountCash, deposit.DepositAmountCash.Value); |
|
1005 |
if (deposit.DepositAmountBill.HasValue) |
|
1006 |
SetPrice(row.Cells, (int)DispColumn.DepositAmountBill, deposit.DepositAmountBill.Value); |
|
1007 |
index++; |
|
1008 |
} |
|
1009 |
index = 0; |
|
1010 |
foreach (var depositDetail in depositOrderer.VisibleDepositDetails) |
|
1011 |
{ |
|
1012 |
var row = dgvMaster.Rows[position + index]; |
|
1013 |
row.Cells[(int)DispColumn.OrderersDivision].Value = depositOrderer.OrderersDivision; |
|
1014 |
row.Cells[(int)DispColumn.OrderersCode].Value = depositOrderer.OrderersCode; |
|
1015 |
row.Cells[(int)DispColumn.RequestNo].Value = depositDetail.RequestNo; |
|
1016 |
row.Cells[(int)DispColumn.LineCount].Value = depositDetail.LineCount; |
|
1017 |
row.Cells[(int)DispColumn.OrderNo].Value = depositDetail.OrderNo; |
|
1018 |
row.Cells[(int)DispColumn.ConstructionName].Value = depositDetail.ConstructionName; |
|
1019 |
row.Cells[(int)DispColumn.ConstructionName_Raw].Value = depositDetail.ConstructionNameRow; |
|
1020 |
// TODO 入金予定日 |
|
1021 |
row.Cells[(int)DispColumn.BillCreationDate].Value = depositDetail.BillCreationDate; |
|
1022 |
SetPrice(row.Cells, (int)DispColumn.BillPrice, depositDetail.BillPrice); |
|
1023 |
SetPrice(row.Cells, (int)DispColumn.TaxPrice, depositDetail.TaxPrice); |
|
1024 |
SetPrice(row.Cells, (int)DispColumn.DepositAmount, depositDetail.DepositAmount); |
|
1025 |
SetPrice(row.Cells, (int)DispColumn.DiscountAmount, depositDetail.DiscountAmount); |
|
1026 |
SetPrice(row.Cells, (int)DispColumn.CnstrPrice, depositDetail.CnstrPrice); |
|
1027 |
SetPrice(row.Cells, (int)DispColumn.Fees, depositDetail.Fees); |
|
1028 |
SetPrice(row.Cells, (int)DispColumn.OtherAdjustments, depositDetail.OtherAdjustments); |
|
1029 |
SetPrice(row.Cells, (int)DispColumn.CarryAmount, depositDetail.CarryAmount); |
|
1030 |
row.Cells[(int)DispColumn.PersonCode].Value = depositDetail.ApprovalPersonCode; |
|
1031 |
row.Cells[(int)DispColumn.PersonName].Value = depositDetail.ApprovalPersonName; |
|
1032 |
// 担当者未承認 |
|
1033 |
if (!depositDetail.IsApprovedByStaff) |
|
1034 |
{ |
|
1035 |
row.Cells[(int)DispColumn.PersonName].Style.ForeColor = Color.Gray; |
|
1036 |
row.Cells[(int)DispColumn.PersonDate].Value = ""; |
|
1037 |
} |
|
1038 |
var j = (int)DispColumn.ApprovalName_1; |
|
1039 |
foreach (var depositeApproval in depositDetail.DepositApprovals) |
|
1040 |
{ |
|
1041 |
row.Cells[j].Value = depositeApproval.ApprovalPersonName; |
|
1042 |
row.Cells[j + 1].Value = depositeApproval.ApprovalPerson; |
|
1043 |
if (depositeApproval.ApprovalDate == "") |
|
1044 |
row.Cells[j].Style.ForeColor = Color.Gray; |
|
1045 |
dgvMaster.Columns[j].Visible = true; |
|
1046 |
j += 5; |
|
1047 |
} |
|
1048 |
index++; |
|
1049 |
} |
|
1050 |
AddBlankRow(depositOrderer, position); |
|
1051 |
AddTotalRow(depositOrderer, position); |
|
1052 |
} |
|
1053 |
catch (Exception ex) |
|
1054 |
{ |
|
1055 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
1056 |
} |
|
1057 |
} |
|
1058 |
#endregion |
|
1059 |
|
|
1060 |
#region 編集可否判定(入金明細データ) |
|
1061 |
#region 編集可否判定 |
|
1062 |
//private bool CanEditDepositDetail(DepositDetail depositDetail) |
|
1063 |
//{ |
|
1064 |
// // 担当者の場合 |
|
1065 |
// if (m_UserInfo.m_Type == CommonDefine.SecurityRankPos.NormalAuthority) |
|
1066 |
// { |
|
1067 |
// // 承認済みなら編集不可 |
|
1068 |
// if (depositDetail.IsApprovedByStaff || depositDetail.IsApprovedByApprover) |
|
1069 |
// return false; |
|
1070 |
// } |
|
1071 |
// // 所属長、統括者の場合 |
|
1072 |
// else if (m_UserInfo.m_Type == CommonDefine.SecurityRankPos.LimitedAuthority || m_UserInfo.m_Type == CommonDefine.SecurityRankPos.FreeAuthority) |
|
1073 |
// { |
|
1074 |
// // 上位の承認者でなければ編集不可 |
|
1075 |
// if (!IsUpperLevelApprover(depositDetail)) |
|
1076 |
// return false; |
|
1077 |
// } |
|
1078 |
// // 特別権限の場合 |
|
1079 |
// else if (m_UserInfo.m_Type == CommonDefine.SecurityRankPos.SpecialAuthority) |
|
1080 |
// { |
|
1081 |
// if (depositDetail.IsApprovedByLastApprover) |
|
1082 |
// return false; |
|
1083 |
// } |
|
1084 |
// return m_UserInfo.CanEditDepositDetail; |
|
1085 |
//} |
|
1086 |
#endregion |
|
1087 |
|
|
1088 |
#region 上位承認者存在チェック |
|
1089 |
//private bool IsUpperLevelApprover(DepositDetail depositDetail) |
|
1090 |
//{ |
|
1091 |
// if (depositDetail.DepositApprovals.Count == 0) |
|
1092 |
// return true; |
|
1093 |
// var lastApproverIndex = depositDetail.DepositApprovals.FindLastIndex(da => da.ApprovalDate != ""); |
|
1094 |
// var myIndex = depositDetail.DepositApprovals.FindLastIndex(da => da.ApprovalPerson == CommonMotions.LoginUserData.PersonCode); |
|
1095 |
// return myIndex > lastApproverIndex; |
|
1096 |
//} |
|
1097 |
#endregion |
|
1098 |
#endregion |
|
1099 |
|
|
1100 |
#region 編集用空白行追加 |
|
1101 |
/// <summary> |
|
1102 |
/// 編集用空白行追加 |
|
1103 |
/// </summary> |
|
1104 |
/// <param name="index"></param> |
|
1105 |
private void AddBlankRow(DepositOrderer depositOrderer, int index) |
|
1106 |
{ |
|
1107 |
var headerIndex = DetectHeaderIndex(index); |
|
1108 |
var headerCells = dgvMaster.Rows[headerIndex].Cells; |
|
1109 |
var blankIndex = dgvMaster.RowCount; |
|
1110 |
for (var i = headerIndex; i < dgvMaster.RowCount; i++) |
|
1111 |
{ |
|
1112 |
var cells = dgvMaster.Rows[i].Cells; |
|
1113 |
if (CommonMotions.cnvInt(headerCells[(int)DispColumn.OrderersDivision].Value) != CommonMotions.cnvInt(cells[(int)DispColumn.OrderersDivision].Value) |
|
1114 |
|| CommonMotions.cnvInt(headerCells[(int)DispColumn.OrderersCode].Value) != CommonMotions.cnvInt(cells[(int)DispColumn.OrderersCode].Value)) |
|
1115 |
{ |
|
1116 |
blankIndex = i; |
|
1117 |
break; |
|
1118 |
} |
|
1119 |
} |
|
1120 |
dgvMaster.Rows.Insert(blankIndex); |
|
1121 |
var row = dgvMaster.Rows[blankIndex]; |
|
1122 |
row.ReadOnly = true; |
|
1123 |
row.Cells[(int)DispColumn.OrderersDivision].Value = headerCells[(int)DispColumn.OrderersDivision].Value; |
|
1124 |
row.Cells[(int)DispColumn.OrderersCode].Value = headerCells[(int)DispColumn.OrderersCode].Value; |
|
1125 |
|
|
1126 |
} |
|
1127 |
#endregion |
|
1128 |
|
|
1129 |
#region 合計行の設定を行う |
|
1130 |
/// <summary> |
|
1131 |
/// 合計行の設定を行う。 |
|
1132 |
/// </summary> |
|
1133 |
/// <param name="index"></param> |
|
1134 |
private void AddTotalRow(DepositOrderer depositOrderer, int index) |
|
1135 |
{ |
|
1136 |
long depositAmountCash = 0; |
|
1137 |
long depositAmountBill = 0; |
|
1138 |
foreach (var deposit in depositOrderer.Deposits) |
|
1139 |
{ |
|
1140 |
depositAmountCash += deposit.DepositAmountCash.GetValueOrDefault(0); |
|
1141 |
depositAmountBill += deposit.DepositAmountBill.GetValueOrDefault(0); |
|
1142 |
} |
|
1143 |
long billPrice = 0; |
|
1144 |
long taxPrice = 0; |
|
1145 |
long depositAmount = 0; |
|
1146 |
long discountAmount = 0; |
|
1147 |
long cnstrPrice = 0; |
|
1148 |
long fees = 0; |
|
1149 |
long otherAdjustments = 0; |
|
1150 |
long carryAmount = 0; |
|
1151 |
foreach (var depositDetail in depositOrderer.DepositDetails) |
|
1152 |
{ |
|
1153 |
billPrice += depositDetail.BillPrice; |
|
1154 |
taxPrice += depositDetail.TaxPrice; |
|
1155 |
depositAmount += depositDetail.DepositAmount; |
|
1156 |
discountAmount += depositDetail.DiscountAmount; |
|
1157 |
cnstrPrice += depositDetail.CnstrPrice; |
|
1158 |
fees += depositDetail.Fees; |
|
1159 |
otherAdjustments += depositDetail.OtherAdjustments; |
|
1160 |
carryAmount += depositDetail.CarryAmount; |
|
1161 |
} |
|
1162 |
var headerIndex = DetectHeaderIndex(index); |
|
1163 |
var headerCells = dgvMaster.Rows[headerIndex].Cells; |
|
1164 |
var subtotalIndex = dgvMaster.RowCount; |
|
1165 |
for (var i = headerIndex; i < dgvMaster.RowCount; i++) |
|
1166 |
{ |
|
1167 |
var cells = dgvMaster.Rows[i].Cells; |
|
1168 |
if (CommonMotions.cnvInt(headerCells[(int)DispColumn.OrderersDivision].Value) != CommonMotions.cnvInt(cells[(int)DispColumn.OrderersDivision].Value) |
|
1169 |
|| CommonMotions.cnvInt(headerCells[(int)DispColumn.OrderersCode].Value) != CommonMotions.cnvInt(cells[(int)DispColumn.OrderersCode].Value)) |
|
1170 |
{ |
|
1171 |
subtotalIndex = i; |
|
1172 |
break; |
|
1173 |
} |
|
1174 |
} |
|
1175 |
dgvMaster.Rows.Insert(subtotalIndex, 4); |
|
1176 |
// 小計 |
|
1177 |
dgvMaster.Rows[subtotalIndex].DefaultCellStyle.BackColor = Color.Coral; |
|
1178 |
dgvMaster.Rows[subtotalIndex].ReadOnly = true; |
|
1179 |
var subtotalCells = dgvMaster.Rows[subtotalIndex].Cells; |
|
1180 |
subtotalCells[(int)DispColumn.OrderersDivision].Value = depositOrderer.OrderersDivision; |
|
1181 |
subtotalCells[(int)DispColumn.OrderersCode].Value = depositOrderer.OrderersCode; |
|
1182 |
subtotalCells[(int)DispColumn.OrderersName].Value = "小計"; |
|
1183 |
SetPrice(subtotalCells, (int)DispColumn.DepositAmountCash, depositAmountCash); |
|
1184 |
SetPrice(subtotalCells, (int)DispColumn.DepositAmountBill, depositAmountBill); |
|
1185 |
SetPrice(subtotalCells, (int)DispColumn.BillPrice, billPrice); |
|
1186 |
SetPrice(subtotalCells, (int)DispColumn.TaxPrice, taxPrice); |
|
1187 |
SetPrice(subtotalCells, (int)DispColumn.DepositAmount, depositAmount); |
|
1188 |
SetPrice(subtotalCells, (int)DispColumn.DiscountAmount, discountAmount); |
|
1189 |
SetPrice(subtotalCells, (int)DispColumn.CnstrPrice, cnstrPrice); |
|
1190 |
SetPrice(subtotalCells, (int)DispColumn.Fees, fees); |
|
1191 |
SetPrice(subtotalCells, (int)DispColumn.OtherAdjustments, otherAdjustments); |
|
1192 |
SetPrice(subtotalCells, (int)DispColumn.CarryAmount, carryAmount); |
|
1193 |
// 入金金額 |
|
1194 |
dgvMaster.Rows[subtotalIndex + 1].DefaultCellStyle.BackColor = Color.Yellow; |
|
1195 |
dgvMaster.Rows[subtotalIndex + 1].ReadOnly = true; |
|
1196 |
var depositCells = dgvMaster.Rows[subtotalIndex + 1].Cells; |
|
1197 |
depositCells[(int)DispColumn.OrderersDivision].Value = depositOrderer.OrderersDivision; |
|
1198 |
depositCells[(int)DispColumn.OrderersCode].Value = depositOrderer.OrderersCode; |
|
1199 |
depositCells[(int)DispColumn.OrderersName].Value = "入金金額"; |
|
1200 |
SetPrice(depositCells, (int)DispColumn.DepositAmountCash, depositAmountCash + depositAmountBill); |
|
1201 |
// 調整後金額 |
|
1202 |
dgvMaster.Rows[subtotalIndex + 2].DefaultCellStyle.BackColor = Color.PaleTurquoise; |
|
1203 |
dgvMaster.Rows[subtotalIndex + 2].ReadOnly = true; |
|
1204 |
var adjustmentCells = dgvMaster.Rows[subtotalIndex + 2].Cells; |
|
1205 |
adjustmentCells[(int)DispColumn.OrderersDivision].Value = depositOrderer.OrderersDivision; |
|
1206 |
adjustmentCells[(int)DispColumn.OrderersCode].Value = depositOrderer.OrderersCode; |
|
1207 |
adjustmentCells[(int)DispColumn.OrderersName].Value = "調整後金額"; |
|
1208 |
SetPrice(adjustmentCells, (int)DispColumn.DepositAmountCash, depositAmount); |
|
1209 |
// 差額 |
|
1210 |
dgvMaster.Rows[subtotalIndex + 3].DefaultCellStyle.BackColor = Color.Chartreuse; |
|
1211 |
dgvMaster.Rows[subtotalIndex + 3].ReadOnly = true; |
|
1212 |
var differentCells = dgvMaster.Rows[subtotalIndex + 3].Cells; |
|
1213 |
differentCells[(int)DispColumn.OrderersDivision].Value = depositOrderer.OrderersDivision; |
|
1214 |
differentCells[(int)DispColumn.OrderersCode].Value = depositOrderer.OrderersCode; |
|
1215 |
differentCells[(int)DispColumn.OrderersName].Value = "差額"; |
|
1216 |
SetPrice(differentCells, (int)DispColumn.DepositAmountCash, depositAmountCash + depositAmountBill - depositAmount); |
|
1217 |
} |
|
1218 |
#endregion |
|
1219 |
|
|
1220 |
#region ヘッダ制御 |
|
1221 |
/// <summary> |
|
1222 |
/// ヘッダ制御 |
|
1223 |
/// </summary> |
|
1224 |
/// <param name="index"></param> |
|
1225 |
private int DetectHeaderIndex(int index) |
|
1226 |
{ |
|
1227 |
for (var i = index; i >= 0; i--) |
|
1228 |
{ |
|
1229 |
if (CommonMotions.cnvString(dgvMaster.Rows[i].Cells[(int)DispColumn.OrderersName].Value) != "") |
|
1230 |
{ |
|
1231 |
return i; |
|
1232 |
} |
|
1233 |
} |
|
1234 |
return 0; |
|
1235 |
} |
|
1236 |
#endregion |
|
1237 |
|
|
1238 |
#region 金額フォーマット |
|
1239 |
/// <summary> |
|
1240 |
/// 金額フォーマット |
|
1241 |
/// </summary> |
|
1242 |
/// <param name="index"></param> |
|
1243 |
private void SetPrice(DataGridViewCellCollection cells, int index, long price) |
|
1244 |
{ |
|
1245 |
cells[index].Value = price.ToString("#,0"); |
|
1246 |
cells[index].Style.ForeColor = Color.Black; |
|
1247 |
if (price < 0) |
|
1248 |
{ |
|
1249 |
cells[index].Style.ForeColor = Color.Red; |
|
1250 |
} |
|
1251 |
} |
|
1252 |
#endregion |
|
1253 |
|
|
1254 |
#region 発注者名フォーマット |
|
1255 |
/// <summary> |
|
1256 |
/// 発注者名フォーマット |
|
1257 |
/// </summary> |
|
1258 |
/// <param name="index"></param> |
|
1259 |
private string ToOrdererName(int corporateStatusPoint, string corporateStatusName, string orderersName1, string orderersName2) |
|
1260 |
{ |
|
1261 |
// 発注者名1△発注者名2 |
|
1262 |
if (corporateStatusPoint == 0) |
|
1263 |
{ |
|
1264 |
if (orderersName2 == "") |
|
1265 |
{ |
|
1266 |
return orderersName1; |
|
1267 |
} |
|
1268 |
return orderersName1 + " " + orderersName2; |
|
1269 |
} |
|
1270 |
// 法人格名称△発注者名1△発注者名2 |
|
1271 |
else if (corporateStatusPoint == 1) |
|
1272 |
{ |
|
1273 |
if (orderersName2 == "") |
|
1274 |
{ |
|
1275 |
return corporateStatusName + " " + orderersName1; |
|
1276 |
} |
|
1277 |
return corporateStatusName + orderersName1 + orderersName2; |
|
1278 |
} |
|
1279 |
// 発注者名1△法人格名称△発注者名2 |
|
1280 |
if (orderersName2 == "") |
|
1281 |
{ |
|
1282 |
return orderersName1 + " " + corporateStatusName; |
|
1283 |
} |
|
1284 |
return orderersName1 + corporateStatusName + orderersName2; |
|
1285 |
} |
|
1286 |
#endregion |
|
1287 |
|
|
1288 |
#region DataGridヘッダ色表示 |
|
1289 |
/// <summary> |
|
1290 |
/// DataGridヘッダ色表示 |
|
1291 |
/// </summary> |
|
1292 |
private void SetGridHeaderColor() |
|
1293 |
{ |
|
1294 |
// ヘッダ色、-1:非表示、0:自動計算、1:総務、2:工事 |
|
1295 |
int[] mc = { |
|
1296 |
-1, // ■編集状態 |
|
1297 |
0, // No |
|
1298 |
-1, // ■発注先区分 |
|
1299 |
-1, // ■発注者コード |
|
1300 |
-1, // ■連番 |
|
1301 |
-1, // ■行番号 |
|
1302 |
0, // 請求先名 |
|
1303 |
1, // 入金日 |
|
1304 |
1, // 入金金額 (振込み) |
|
1305 |
1, // 入金金額 (手形) |
|
1306 |
-1, // 請求No. |
|
1307 |
-1, // 受付番号 |
|
1308 |
0, // 現場名 |
|
1309 |
-1, // ■現場名 (DB登録値) |
|
1310 |
0, // 入金予定日 |
|
1311 |
0, // 請求日 |
|
1312 |
0, // 請求金額 (税抜) |
|
1313 |
0, // 請求金額 (消費税) |
|
1314 |
2, // 入金金額 |
|
1315 |
2, // 値引金額 |
|
1316 |
2, // 協力金 |
|
1317 |
2, // 手数料 |
|
1318 |
2, // その他調整 |
|
1319 |
2, // 次回繰越 |
|
1320 |
0, // 担当者承認 |
|
1321 |
-1, // ■担当者コード |
|
1322 |
-1, // ■担当者日付 |
|
1323 |
0, // 承認者1承認 |
|
1324 |
-1, // ■承認者コード_1 |
|
1325 |
-1, // ■承認権限区分_1 |
|
1326 |
-1, // ■承認日付_1 |
|
1327 |
-1, // ■承認順番_1 |
|
1328 |
0, // 承認者2承認 |
|
1329 |
-1, // ■承認者コード_2 |
|
1330 |
-1, // ■承認権限区分_2 |
|
1331 |
-1, // ■承認日付_2 |
|
1332 |
-1, // ■承認順番_2 |
|
1333 |
0, // 承認者3承認 |
|
1334 |
-1, // ■承認者コード_3 |
|
1335 |
-1, // ■承認権限区分_3 |
|
1336 |
-1, // ■承認日付_3 |
|
1337 |
-1, // ■承認順番_3 |
|
1338 |
0, // 承認者4承認 |
|
1339 |
-1, // ■承認者コード_4 |
|
1340 |
-1, // ■承認権限区分_4 |
|
1341 |
-1, // ■承認日付_4 |
|
1342 |
-1, // ■承認順番_4 |
|
1343 |
0, // 承認者5承認 |
|
1344 |
-1, // ■承認者コード_5 |
|
1345 |
-1, // ■承認権限区分_5 |
|
1346 |
-1, // ■承認日付_5 |
|
1347 |
-1, // ■承認順番_5 |
|
1348 |
0, // 承認者6承認 |
|
1349 |
-1, // ■承認者コード_6 |
|
1350 |
-1, // ■承認権限区分_6 |
|
1351 |
-1, // ■承認日付_6 |
|
1352 |
-1, // ■承認順番_6 |
|
1353 |
0, // 承認者7承認 |
|
1354 |
-1, // ■承認者コード_7 |
|
1355 |
-1, // ■承認権限区分_7 |
|
1356 |
-1, // ■承認日付_7 |
|
1357 |
-1, // ■承認順番_7 |
|
1358 |
0, // 承認者8承認 |
|
1359 |
-1, // ■承認者コード_8 |
|
1360 |
-1, // ■承認権限区分_8 |
|
1361 |
-1, // ■承認日付_8 |
|
1362 |
-1, // ■承認順番_8 |
|
1363 |
0, // 承認者9承認 |
|
1364 |
-1, // ■承認者コード_9 |
|
1365 |
-1, // ■承認権限区分_9 |
|
1366 |
-1, // ■承認日付_9 |
|
1367 |
-1, // ■承認順番_9 |
|
1368 |
0, // 承認者10承認 |
|
1369 |
-1, // ■承認者コード_10 |
|
1370 |
-1, // ■承認権限区分_10 |
|
1371 |
-1, // ■承認日付_10 |
|
1372 |
-1, // ■承認順番_10 |
|
1373 |
}; |
|
1374 |
|
|
1375 |
dgvMaster.Font = new System.Drawing.Font("MS 明朝", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128))); |
|
1376 |
dgvMaster.ColumnHeadersHeight = dgvMaster.ColumnHeadersHeight + 10; |
|
1377 |
|
|
1378 |
// ヘッダーセルの値の設定 |
|
1379 |
for (int i = 0; i < 77; i++) |
|
1380 |
{ |
|
1381 |
// ヘッダーセルの色を設定 |
|
1382 |
// 総務 |
|
1383 |
if (mc[i] == 1) |
|
1384 |
{ |
|
1385 |
dgvMaster.Columns[i].HeaderCell.Style.BackColor = Color.Coral; |
|
1386 |
} |
|
1387 |
// 工事担当者 |
|
1388 |
else if (mc[i] == 2) |
|
1389 |
{ |
|
1390 |
dgvMaster.Columns[i].HeaderCell.Style.BackColor = Color.SkyBlue; |
|
1391 |
} |
|
1392 |
// 表示・自動計算 |
|
1393 |
else |
|
1394 |
{ |
|
1395 |
dgvMaster.Columns[i].HeaderCell.Style.BackColor = Color.PaleGreen; |
|
1396 |
} |
|
1397 |
} |
|
1398 |
} |
|
1399 |
#endregion |
|
1400 |
|
|
1401 |
#region 表示権限チェック① |
|
1402 |
/// <summary> |
|
1403 |
/// 表示権限のチェックを実施する。 |
|
1404 |
/// </summary> |
|
1405 |
/// <param name="orderer"></param> |
|
1406 |
/// <returns></returns> |
|
1407 |
private bool CheckOrdererPermission(DepositOrderer orderer) |
|
1408 |
{ |
|
1409 |
try |
|
1410 |
{ |
|
1411 |
// 全部署対象 |
|
1412 |
if (m_UserInfo.m_SecRange == ClsSecurityPermission.SecRangeType.AllDepartment) |
|
1413 |
{ |
|
1414 |
return true; |
|
1415 |
} |
|
1416 |
var ioPdm = new IOMPersonDepartment(); |
|
1417 |
var arDataPdm = new ArrayList(); |
|
1418 |
var sql = new StringBuilder(); |
|
1419 |
sql.Append("select count(*) from ConstructionBaseInfo Cbi "); |
|
1420 |
sql.Append("inner join PersonInChargeMaster PicM on PicM.PersonCode = Cbi.ConstructionPersonCode "); |
|
1421 |
sql.Append("inner join PersonDepartmentMaster PdM on PdM.DepartmentCode = PicM.DepartmentCode "); |
|
1422 |
sql.AppendFormat("where Cbi.OrderersDivision = {0} ", orderer.OrderersDivision); |
|
1423 |
sql.AppendFormat("and Cbi.OrderersCode = {0} ", orderer.OrderersCode); |
|
1424 |
sql.AppendFormat("and PdM.PersonCode = {0} ", CommonMotions.LoginUserData.PersonCode); |
|
1425 |
sql.AppendFormat("and PdM.DepartmentCode = {0} ", CommonMotions.LoginUserData.DepartmentCode); |
|
1426 |
// 自部門のみ表示の場合 |
|
1427 |
if (m_UserInfo.m_SecRange == ClsSecurityPermission.SecRangeType.OneDepartment) |
|
1428 |
{ |
|
1429 |
sql.Append("and Pdm.AffiliationFlg = 1 "); |
|
1430 |
} |
|
1431 |
// 担当分のみ対象の場合 |
|
1432 |
else if (m_UserInfo.m_SecRange == ClsSecurityPermission.SecRangeType.InCharge) |
|
1433 |
{ |
|
1434 |
sql.AppendFormat("and (Cbi.ConstructionPersonCode = {0} ", CommonMotions.LoginUserData.PersonCode); |
|
1435 |
sql.AppendFormat("or Cbi.ConstrSubPersonCode = {0} ", CommonMotions.LoginUserData.PersonCode); |
|
1436 |
sql.AppendFormat("or Cbi.ConstructionInstructor = {0}) ", CommonMotions.LoginUserData.PersonCode); |
|
1437 |
} |
|
1438 |
if (!ioPdm.ExecuteReader(sql.ToString(), ref arDataPdm)) |
|
1439 |
return false; |
|
1440 |
return CommonMotions.cnvInt(((object[])arDataPdm[0])[0]) > 0; |
|
1441 |
} |
|
1442 |
catch (Exception ex) |
|
1443 |
{ |
|
1444 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
1445 |
return false; |
|
1446 |
} |
|
1447 |
} |
|
1448 |
#endregion |
|
1449 |
|
|
1450 |
#region 表示権限チェック② |
|
1451 |
/// <summary> |
|
1452 |
/// 表示権限のチェックを実施する。 |
|
1453 |
/// </summary> |
|
1454 |
/// <param name="DepartmentCode"></param> |
|
1455 |
/// <param name="ConstructionPersonCode"></param> |
|
1456 |
/// <param name="ConstrSubPersonCode"></param> |
|
1457 |
/// <param name="ConstructionInstructor"></param> |
|
1458 |
/// <returns></returns> |
|
1459 |
private bool CheckPermission(int DepartmentCode, int ConstructionPersonCode, int ConstrSubPersonCode, int ConstructionInstructor) |
|
1460 |
{ |
|
1461 |
try |
|
1462 |
{ |
|
1463 |
// 全部署対象 |
|
1464 |
if (m_UserInfo.m_SecRange == ClsSecurityPermission.SecRangeType.AllDepartment) |
|
1465 |
{ |
|
1466 |
return true; |
|
1467 |
} |
|
1468 |
|
|
1469 |
// 複数部署対象、または自部署のみ対象 |
|
1470 |
else if ((m_UserInfo.m_SecRange == ClsSecurityPermission.SecRangeType.MultiDepartment) || (m_UserInfo.m_SecRange == ClsSecurityPermission.SecRangeType.OneDepartment)) |
|
1471 |
{ |
|
1472 |
var ioPdm = new IOMPersonDepartment(); |
|
1473 |
var arDataPdm = new ArrayList(); |
|
1474 |
var sql = new StringBuilder(); |
|
1475 |
sql.AppendLine("select Pdm.DepartmentCode "); |
|
1476 |
sql.AppendLine("from PersonDepartmentMaster as Pdm "); |
|
1477 |
sql.AppendFormat("where Pdm.PersonCode = {0} ", CommonMotions.LoginUserData.PersonCode); |
|
1478 |
if (m_UserInfo.m_SecRange == ClsSecurityPermission.SecRangeType.OneDepartment) |
|
1479 |
{ |
|
1480 |
sql.AppendLine("and Pdm.AffiliationFlg = 1 "); |
|
1481 |
} |
|
1482 |
if (!ioPdm.ExecuteReader(sql.ToString(), ref arDataPdm)) |
|
1483 |
return false; |
|
1484 |
foreach (object[] work in arDataPdm) |
|
1485 |
{ |
|
1486 |
if (CommonMotions.cnvInt(work[0]) == DepartmentCode) |
|
1487 |
{ |
|
1488 |
return true; |
|
1489 |
} |
|
1490 |
} |
|
1491 |
return false; |
|
1492 |
} |
|
1493 |
// 担当分のみ対象 |
|
1494 |
else |
|
1495 |
{ |
|
1496 |
if ((CommonMotions.LoginUserData.PersonCode == ConstructionPersonCode) || |
他の形式にエクスポート: Unified diff