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 |
41 |
|
42 |
|
private static string[] s_SQLPart1_1 = new string[] { " FROM CONSTRUCTIONBASEINFO A",
|
|
42 |
private static string[] s_SQLPart1_1 = new string[] { ", -1, 0, A.JoinFlg, A.TyingFlg" };
|
|
43 |
|
|
44 |
private static string[] s_SQLPart1_2 = new string[] { ", ifnull(App.ApprovalStatus, -1), ifnull(App.OrderNo, 0), A.JoinFlg, A.TyingFlg" };
|
|
45 |
|
|
46 |
private static string[] s_SQLPart2 = new string[] { " FROM CONSTRUCTIONBASEINFO A",
|
43 |
47 |
" LEFT JOIN CONSTRUCTIONBASEINFODETAIL B",
|
44 |
48 |
" ON A.CONSTRUCTIONCODE = B.CONSTRUCTIONCODE",
|
45 |
49 |
string.Format(" AND B.DETAILNO = {0}", (int)ConstructionBaseInfoDetail.DataNoDef.ConstructionName)};
|
46 |
50 |
|
47 |
|
private static string[] s_SQLPart2 = new string[] { " LEFT JOIN (SELECT CA.CONSTRUCTIONCODE, CA.SALESPERSONCODE PERSONCODE, CB.PERSONNAME PERSONNAME,",
|
|
51 |
private static string[] s_SQLPart3 = new string[] { " LEFT JOIN (SELECT CA.CONSTRUCTIONCODE, CA.SALESPERSONCODE PERSONCODE, CB.PERSONNAME PERSONNAME,",
|
48 |
52 |
" CB.DEPARTMENTCODE DEPARTMENTCODE, CC.DEPARTMENTSTRING DEPARTMENTNAME,",
|
49 |
53 |
" CB.DISPLAYORDER MANDISPORDER, CC.DISPLAYORDER DEPDISPORDER",
|
50 |
54 |
" FROM CONSTRUCTIONBASEINFO CA",
|
... | ... | |
52 |
56 |
" LEFT JOIN DEPARTMENTMASTER CC ON CB.DEPARTMENTCODE = CC.DEPARTMENTCODE",
|
53 |
57 |
" WHERE CA.CONSTRUCTIONPERIOD = {0}) C ON A.CONSTRUCTIONCODE = C.CONSTRUCTIONCODE" };
|
54 |
58 |
|
55 |
|
private static string[] s_SQLPart3 = new string[] { " LEFT JOIN (SELECT DA.CONSTRUCTIONCODE, DA.CONSTRUCTIONPERSONCODE PERSONCODE, DB.PERSONNAME PERSONNAME,",
|
|
59 |
private static string[] s_SQLPart3_1 = new string[] { " LEFT JOIN (SELECT DA.CONSTRUCTIONCODE, DA.CONSTRUCTIONPERSONCODE PERSONCODE, DB.PERSONNAME PERSONNAME,",
|
56 |
60 |
" DB.DEPARTMENTCODE DEPARTMENTCODE, DC.DEPARTMENTSTRING DEPARTMENTNAME,",
|
57 |
61 |
" DB.DISPLAYORDER MANDISPORDER, DC.DISPLAYORDER DEPDISPORDER",
|
58 |
62 |
" FROM CONSTRUCTIONBASEINFO DA",
|
... | ... | |
60 |
64 |
" LEFT JOIN DEPARTMENTMASTER DC ON DB.DEPARTMENTCODE = DC.DEPARTMENTCODE",
|
61 |
65 |
" WHERE DA.CONSTRUCTIONPERIOD = {0}) D ON A.CONSTRUCTIONCODE = D.CONSTRUCTIONCODE" };
|
62 |
66 |
|
63 |
|
private static string[] s_SQLPart4 = new string[] { " WHERE A.CONSTRUCTIONPERIOD = {0}" };
|
|
67 |
private static string[] s_SQLPart3_2 = new string[] { " LEFT JOIN processapproval AS App ON",
|
|
68 |
" App.ConstructionCode = A.ConstructionCode",
|
|
69 |
" AND App.ApprovalCode = {0}",
|
|
70 |
" And App.OrderNo = {0}",
|
|
71 |
" And App.SeqNo = 1"};
|
64 |
72 |
|
65 |
|
private static string[] s_SQLPart4Tying = new string[] { " WHERE A.CONSTRUCTIONPERIOD = {0}",
|
|
73 |
private static string[] s_SQLPart5 = new string[] { " WHERE A.CONSTRUCTIONPERIOD = {0}" };
|
|
74 |
|
|
75 |
private static string[] s_SQLPart5Tying = new string[] { " WHERE A.CONSTRUCTIONPERIOD = {0}",
|
66 |
76 |
string.Format(" AND A.TYINGFLG != {0}", (int)ConstructionBaseInfo.TyingFlgDef.Tying) };
|
67 |
77 |
|
68 |
|
private static string[] s_SQLPart5 = new string[] { " ORDER BY A.CONSTRUCTIONSTATUSFLG ASC, C.DEPDISPORDER ASC, C.MANDISPORDER ASC,",
|
|
78 |
private static string[] s_SQLPart6 = new string[] { " ORDER BY A.CONSTRUCTIONSTATUSFLG ASC, C.DEPDISPORDER ASC, C.MANDISPORDER ASC,",
|
69 |
79 |
" D.DEPDISPORDER ASC, D.MANDISPORDER ASC, A.CONSTRUCTIONCODE DESC" };
|
70 |
80 |
#endregion
|
71 |
81 |
|
... | ... | |
93 |
103 |
CONSTDEPDISPORDER,
|
94 |
104 |
AppStatus,
|
95 |
105 |
ORDERNO,
|
|
106 |
JOINFLG,
|
|
107 |
TYINGFLG,
|
96 |
108 |
}
|
97 |
109 |
#endregion
|
98 |
110 |
|
... | ... | |
329 |
341 |
{
|
330 |
342 |
StringBuilder wrkFormat = new StringBuilder();
|
331 |
343 |
for (int i = 0; i < s_SQLPart1.Length; i++) wrkFormat.Append(s_SQLPart1[i]);
|
|
344 |
wrkFormat.Append(s_SQLPart1_1[0]);
|
332 |
345 |
|
333 |
346 |
// ???t?B?[???h???????????
|
334 |
|
wrkFormat.Append(", 0, 0");
|
335 |
347 |
wrkFormat.Append(", A.EstimateType, A.RequestedDate, A.EstimatesSubmittedDate");
|
336 |
348 |
|
337 |
|
for (int i = 0; i < s_SQLPart1_1.Length; i++) wrkFormat.Append(s_SQLPart1_1[i]);
|
|
349 |
for (int i = 0; i < s_SQLPart2.Length; i++) wrkFormat.Append(s_SQLPart2[i]);
|
338 |
350 |
|
339 |
|
for (int i = 0; i < s_SQLPart2.Length; i++) wrkFormat.Append(s_SQLPart2[i]);
|
340 |
351 |
for (int i = 0; i < s_SQLPart3.Length; i++) wrkFormat.Append(s_SQLPart3[i]);
|
341 |
|
for (int i = 0; i < s_SQLPart4Tying.Length; i++) wrkFormat.Append(s_SQLPart4Tying[i]);
|
|
352 |
for (int i = 0; i < s_SQLPart3_1.Length; i++) wrkFormat.Append(s_SQLPart3_1[i]);
|
|
353 |
for (int i = 0; i < s_SQLPart5Tying.Length; i++) wrkFormat.Append(s_SQLPart5Tying[i]);
|
342 |
354 |
|
343 |
355 |
strSQL.AppendFormat(wrkFormat.ToString(), numUDConstPro.Value);
|
344 |
356 |
|
... | ... | |
354 |
366 |
strSQL.Append(wrkBuff);
|
355 |
367 |
|
356 |
368 |
// ORDER BY ???
|
357 |
|
for (int i = 0; i < s_SQLPart5.Length; i++) strSQL.Append(s_SQLPart5[i]);
|
|
369 |
for (int i = 0; i < s_SQLPart6.Length; i++) strSQL.Append(s_SQLPart6[i]);
|
358 |
370 |
}
|
359 |
371 |
catch (Exception ex)
|
360 |
372 |
{
|
... | ... | |
381 |
393 |
|
382 |
394 |
StringBuilder wrkFormat = new StringBuilder();
|
383 |
395 |
for (int i = 0; i < s_SQLPart1.Length; i++) wrkFormat.Append(s_SQLPart1[i]);
|
384 |
|
wrkFormat.Append(", -1, 0"); // ???t?B?[???h???????????
|
385 |
|
for (int i = 0; i < s_SQLPart1_1.Length; i++) wrkFormat.Append(s_SQLPart1_1[i]);
|
|
396 |
wrkFormat.Append(s_SQLPart1_1[0]);
|
|
397 |
for (int i = 0; i < s_SQLPart2.Length; i++) wrkFormat.Append(s_SQLPart2[i]);
|
386 |
398 |
|
387 |
|
for (int i = 0; i < s_SQLPart2.Length; i++) wrkFormat.Append(s_SQLPart2[i]);
|
388 |
399 |
for (int i = 0; i < s_SQLPart3.Length; i++) wrkFormat.Append(s_SQLPart3[i]);
|
389 |
|
for (int i = 0; i < s_SQLPart4.Length; i++) wrkFormat.Append(s_SQLPart4[i]);
|
|
400 |
for (int i = 0; i < s_SQLPart3_1.Length; i++) wrkFormat.Append(s_SQLPart3_1[i]);
|
|
401 |
for (int i = 0; i < s_SQLPart5.Length; i++) wrkFormat.Append(s_SQLPart5[i]);
|
390 |
402 |
|
391 |
403 |
strSQL.AppendFormat(wrkFormat.ToString(), numUDConstPro.Value);
|
392 |
404 |
strSQL.AppendFormat(" AND A.ConstructionStatusFlg < {0}", ProgressComplete);
|
... | ... | |
405 |
417 |
strSQL.Append(" UNION ");
|
406 |
418 |
wrkFormat.Clear();
|
407 |
419 |
for (int i = 0; i < s_SQLPart1.Length; i++) wrkFormat.Append(s_SQLPart1[i]);
|
408 |
|
wrkFormat.Append(", ifnull(App.ApprovalStatus, -1), ifnull(App.OrderNo, 0)");
|
409 |
|
for (int i = 0; i < s_SQLPart1_1.Length; i++) wrkFormat.Append(s_SQLPart1_1[i]);
|
|
420 |
wrkFormat.Append(s_SQLPart1_2[0]);
|
|
421 |
|
|
422 |
for (int i = 0; i < s_SQLPart2.Length; i++) wrkFormat.Append(s_SQLPart2[i]);
|
410 |
423 |
|
411 |
|
for (int i = 0; i < s_SQLPart2.Length; i++) wrkFormat.Append(s_SQLPart2[i]);
|
412 |
424 |
for (int i = 0; i < s_SQLPart3.Length; i++) wrkFormat.Append(s_SQLPart3[i]);
|
|
425 |
for (int i = 0; i < s_SQLPart3_1.Length; i++) wrkFormat.Append(s_SQLPart3_1[i]);
|
413 |
426 |
|
414 |
|
wrkFormat.Append(" LEFT JOIN processapproval AS App ON App.ConstructionCode = A.ConstructionCode");
|
415 |
|
wrkFormat.AppendFormat(" AND App.ApprovalCode = {0}", (int)ClsExcute.ApprovalListNo.EstimateApproval);
|
416 |
|
wrkFormat.AppendFormat(" And App.OrderNo = {0}", CommonDefine.s_Default_OrderNo);
|
417 |
|
wrkFormat.Append(" And App.SeqNo = 1");
|
|
427 |
wrkFormat.Append(s_SQLPart3_2[0]);
|
|
428 |
wrkFormat.Append(s_SQLPart3_2[1]);
|
|
429 |
wrkFormat.AppendFormat(s_SQLPart3_2[2], (int)ClsExcute.ApprovalListNo.EstimateApproval);
|
|
430 |
wrkFormat.AppendFormat(s_SQLPart3_2[3], CommonDefine.s_Default_OrderNo);
|
|
431 |
wrkFormat.Append(s_SQLPart3_2[4]);
|
418 |
432 |
|
419 |
|
for (int i = 0; i < s_SQLPart4.Length; i++) wrkFormat.Append(s_SQLPart4[i]);
|
|
433 |
for (int i = 0; i < s_SQLPart5.Length; i++) wrkFormat.Append(s_SQLPart5[i]);
|
420 |
434 |
strSQL.AppendFormat(wrkFormat.ToString(), numUDConstPro.Value);
|
421 |
435 |
|
422 |
436 |
strSQL.Append(" AND EXISTS (SELECT * FROM ESTIMATEDATA C WHERE C.CONSTRUCTIONCODE = A.CONSTRUCTIONCODE)");
|
... | ... | |
460 |
474 |
|
461 |
475 |
StringBuilder wrkFormat = new StringBuilder();
|
462 |
476 |
for (int i = 0; i < s_SQLPart1.Length; i++) wrkFormat.Append(s_SQLPart1[i]);
|
|
477 |
wrkFormat.Append(s_SQLPart1_1[0]);
|
463 |
478 |
wrkFormat.Append(", DATE_FORMAT(A.EstimatesSubmittedDate, '%Y/%m/%d'), 0"); // ???t?B?[???h???????????
|
464 |
|
for (int i = 0; i < s_SQLPart1_1.Length; i++) wrkFormat.Append(s_SQLPart1_1[i]);
|
|
479 |
for (int i = 0; i < s_SQLPart2.Length; i++) wrkFormat.Append(s_SQLPart2[i]);
|
465 |
480 |
|
466 |
|
for (int i = 0; i < s_SQLPart2.Length; i++) wrkFormat.Append(s_SQLPart2[i]);
|
467 |
481 |
for (int i = 0; i < s_SQLPart3.Length; i++) wrkFormat.Append(s_SQLPart3[i]);
|
468 |
|
wrkFormat.Append(", PROCESSAPPROVAL A1");
|
469 |
|
for (int i = 0; i < s_SQLPart4.Length; i++) wrkFormat.Append(s_SQLPart4[i]);
|
|
482 |
for (int i = 0; i < s_SQLPart3_1.Length; i++) wrkFormat.Append(s_SQLPart3_1[i]);
|
|
483 |
wrkFormat.Append(", PROCESSAPPROVAL App");
|
|
484 |
for (int i = 0; i < s_SQLPart5.Length; i++) wrkFormat.Append(s_SQLPart5[i]);
|
470 |
485 |
|
471 |
486 |
strSQL.AppendFormat(wrkFormat.ToString(), numUDConstPro.Value);
|
472 |
|
strSQL.AppendFormat(" AND (A.CONSTRUCTIONCODE = A1.CONSTRUCTIONCODE And A1.ApprovalCode = {0} And A1.SeqNo = 1", ApprovalCode);
|
473 |
|
strSQL.AppendFormat(" And A1.ApprovalStatus = {0})", (int)CommonDefine.ApprovalStatus.Approval);
|
|
487 |
|
|
488 |
// Left Join???????????????
|
|
489 |
strSQL.Append(" And (");
|
|
490 |
strSQL.Append(s_SQLPart3_2[1]);
|
|
491 |
strSQL.AppendFormat(s_SQLPart3_2[2], (int)ClsExcute.ApprovalListNo.EstimateApproval);
|
|
492 |
strSQL.AppendFormat(s_SQLPart3_2[3], CommonDefine.s_Default_OrderNo);
|
|
493 |
strSQL.Append(s_SQLPart3_2[4]);
|
|
494 |
strSQL.AppendFormat(" And App.ApprovalStatus = {0})", (int)CommonDefine.ApprovalStatus.Approval);
|
|
495 |
strSQL.Append(") ");
|
474 |
496 |
|
475 |
497 |
// ???????I???????????
|
476 |
498 |
strSQL.Append(GetDepartmentString());
|
... | ... | |
484 |
506 |
strSQL.Append(wrkBuff.ToString());
|
485 |
507 |
|
486 |
508 |
// ORDER BY ???
|
487 |
|
for (int i = 0; i < s_SQLPart5.Length; i++) strSQL.Append(s_SQLPart5[i]);
|
|
509 |
for (int i = 0; i < s_SQLPart6.Length; i++) strSQL.Append(s_SQLPart6[i]);
|
488 |
510 |
}
|
489 |
511 |
catch (Exception ex)
|
490 |
512 |
{
|
... | ... | |
511 |
533 |
|
512 |
534 |
StringBuilder wrkFormat = new StringBuilder();
|
513 |
535 |
for (int i = 0; i < s_SQLPart1.Length; i++) wrkFormat.Append(s_SQLPart1[i]);
|
514 |
|
wrkFormat.Append(", -1, 0"); // ???t?B?[???h???????????
|
515 |
|
for (int i = 0; i < s_SQLPart1_1.Length; i++) wrkFormat.Append(s_SQLPart1_1[i]);
|
|
536 |
wrkFormat.Append(s_SQLPart1_1[0]);
|
|
537 |
for (int i = 0; i < s_SQLPart2.Length; i++) wrkFormat.Append(s_SQLPart2[i]);
|
516 |
538 |
|
517 |
|
for (int i = 0; i < s_SQLPart2.Length; i++) wrkFormat.Append(s_SQLPart2[i]);
|
518 |
539 |
for (int i = 0; i < s_SQLPart3.Length; i++) wrkFormat.Append(s_SQLPart3[i]);
|
519 |
|
for (int i = 0; i < s_SQLPart4.Length; i++) wrkFormat.Append(s_SQLPart4[i]);
|
|
540 |
for (int i = 0; i < s_SQLPart3_1.Length; i++) wrkFormat.Append(s_SQLPart3_1[i]);
|
|
541 |
for (int i = 0; i < s_SQLPart5.Length; i++) wrkFormat.Append(s_SQLPart5[i]);
|
520 |
542 |
|
521 |
543 |
strSQL.AppendFormat(wrkFormat.ToString(), numUDConstPro.Value);
|
522 |
544 |
strSQL.Append(" AND EXISTS (SELECT * FROM ESTIMATEDATA C WHERE C.CONSTRUCTIONCODE = A.CONSTRUCTIONCODE)");
|
... | ... | |
537 |
559 |
strSQL.Append(" UNION ");
|
538 |
560 |
wrkFormat.Clear();
|
539 |
561 |
for (int i = 0; i < s_SQLPart1.Length; i++) wrkFormat.Append(s_SQLPart1[i]);
|
540 |
|
wrkFormat.Append(", ifnull(App.ApprovalStatus, -1), ifnull(App.OrderNo, 0)");
|
541 |
|
for (int i = 0; i < s_SQLPart1_1.Length; i++) wrkFormat.Append(s_SQLPart1_1[i]);
|
|
562 |
wrkFormat.Append(s_SQLPart1_2[0]);
|
|
563 |
for (int i = 0; i < s_SQLPart2.Length; i++) wrkFormat.Append(s_SQLPart2[i]);
|
542 |
564 |
|
543 |
|
for (int i = 0; i < s_SQLPart2.Length; i++) wrkFormat.Append(s_SQLPart2[i]);
|
544 |
565 |
for (int i = 0; i < s_SQLPart3.Length; i++) wrkFormat.Append(s_SQLPart3[i]);
|
|
566 |
for (int i = 0; i < s_SQLPart3_1.Length; i++) wrkFormat.Append(s_SQLPart3_1[i]);
|
545 |
567 |
|
546 |
|
wrkFormat.Append(" LEFT JOIN processapproval AS App ON App.ConstructionCode = A.ConstructionCode");
|
547 |
|
wrkFormat.AppendFormat(" AND App.ApprovalCode = {0}", (int)ClsExcute.ApprovalListNo.EstimateBudgetApproval);
|
548 |
|
wrkFormat.AppendFormat(" And App.OrderNo = {0}", CommonDefine.s_Default_OrderNo);
|
549 |
|
wrkFormat.Append(" And App.SeqNo = 1");
|
|
568 |
wrkFormat.Append(s_SQLPart3_2[0]);
|
|
569 |
wrkFormat.Append(s_SQLPart3_2[1]);
|
|
570 |
wrkFormat.AppendFormat(s_SQLPart3_2[2], (int)ClsExcute.ApprovalListNo.EstimateBudgetApproval);
|
|
571 |
wrkFormat.AppendFormat(s_SQLPart3_2[3], CommonDefine.s_Default_OrderNo);
|
|
572 |
wrkFormat.Append(s_SQLPart3_2[4]);
|
550 |
573 |
|
551 |
|
for (int i = 0; i < s_SQLPart4.Length; i++) wrkFormat.Append(s_SQLPart4[i]);
|
|
574 |
for (int i = 0; i < s_SQLPart5.Length; i++) wrkFormat.Append(s_SQLPart5[i]);
|
552 |
575 |
|
553 |
576 |
strSQL.AppendFormat(wrkFormat.ToString(), numUDConstPro.Value);
|
554 |
577 |
strSQL.Append(" AND EXISTS (SELECT * FROM ESTIMATEBUDGET A1 WHERE A1.CONSTRUCTIONCODE = A.CONSTRUCTIONCODE)");
|
... | ... | |
598 |
621 |
|
599 |
622 |
StringBuilder wrkFormat = new StringBuilder();
|
600 |
623 |
for (int i = 0; i < s_SQLPart1.Length; i++) wrkFormat.Append(s_SQLPart1[i]);
|
601 |
|
wrkFormat.Append(", -1, 0"); // ???t?B?[???h???????????
|
602 |
|
for (int i = 0; i < s_SQLPart1_1.Length; i++) wrkFormat.Append(s_SQLPart1_1[i]);
|
|
624 |
wrkFormat.Append(s_SQLPart1_1[0]);
|
|
625 |
for (int i = 0; i < s_SQLPart2.Length; i++) wrkFormat.Append(s_SQLPart2[i]);
|
603 |
626 |
|
604 |
|
for (int i = 0; i < s_SQLPart2.Length; i++) wrkFormat.Append(s_SQLPart2[i]);
|
605 |
627 |
for (int i = 0; i < s_SQLPart3.Length; i++) wrkFormat.Append(s_SQLPart3[i]);
|
606 |
|
wrkFormat.Append(", PROCESSAPPROVAL A1");
|
607 |
|
for (int i = 0; i < s_SQLPart4.Length; i++) wrkFormat.Append(s_SQLPart4[i]);
|
|
628 |
for (int i = 0; i < s_SQLPart3_1.Length; i++) wrkFormat.Append(s_SQLPart3_1[i]);
|
|
629 |
wrkFormat.Append(", PROCESSAPPROVAL App");
|
|
630 |
for (int i = 0; i < s_SQLPart5.Length; i++) wrkFormat.Append(s_SQLPart5[i]);
|
608 |
631 |
wrkFormat.Append(" AND A.CONSTRUCTIONPERSONCODE != 0");
|
609 |
632 |
strSQL.AppendFormat(wrkFormat.ToString(), numUDConstPro.Value);
|
610 |
633 |
|
... | ... | |
612 |
635 |
strSQL.AppendFormat(" And {0} <= A.ConstructionStatusFlg", ProgressStart);
|
613 |
636 |
strSQL.AppendFormat(" And A.ConstructionStatusFlg < {0}", ProgressComplete);
|
614 |
637 |
strSQL.Append(" And A.ConstructionPersonCode != 0");
|
615 |
|
strSQL.AppendFormat(" AND (A.CONSTRUCTIONCODE = A1.CONSTRUCTIONCODE AND A1.APPROVALCODE = {0}", (int)ClsExcute.ApprovalListNo.EstimateApproval);
|
616 |
|
strSQL.AppendFormat(" AND SEQNO = 1 AND ApprovalStatus = {0})", (int)CommonDefine.ApprovalStatus.Approval);
|
|
638 |
|
|
639 |
// Left Join???????????????
|
|
640 |
strSQL.Append(" And (");
|
|
641 |
strSQL.Append(s_SQLPart3_2[1]);
|
|
642 |
strSQL.AppendFormat(s_SQLPart3_2[2], (int)ClsExcute.ApprovalListNo.EstimateApproval);
|
|
643 |
strSQL.AppendFormat(s_SQLPart3_2[3], CommonDefine.s_Default_OrderNo);
|
|
644 |
strSQL.Append(s_SQLPart3_2[4]);
|
|
645 |
strSQL.AppendFormat(" And App.ApprovalStatus = {0}", (int)CommonDefine.ApprovalStatus.Approval);
|
|
646 |
strSQL.Append(") ");
|
|
647 |
|
617 |
648 |
strSQL.Append(" AND NOT EXISTS (SELECT * FROM CONSTRUCTIONBUDGET C WHERE C.CONSTRUCTIONCODE = A.CONSTRUCTIONCODE)");
|
618 |
649 |
|
619 |
650 |
// ???????I???????????
|
... | ... | |
628 |
659 |
strSQL.Append(" UNION ");
|
629 |
660 |
wrkFormat.Clear();
|
630 |
661 |
for (int i = 0; i < s_SQLPart1.Length; i++) wrkFormat.Append(s_SQLPart1[i]);
|
631 |
|
wrkFormat.Append(", ifnull(App.ApprovalStatus, -1), ifnull(App.OrderNo, 0)");
|
632 |
|
for (int i = 0; i < s_SQLPart1_1.Length; i++) wrkFormat.Append(s_SQLPart1_1[i]);
|
|
662 |
wrkFormat.Append(s_SQLPart1_2[0]);
|
|
663 |
for (int i = 0; i < s_SQLPart2.Length; i++) wrkFormat.Append(s_SQLPart2[i]);
|
633 |
664 |
|
634 |
|
for (int i = 0; i < s_SQLPart2.Length; i++) wrkFormat.Append(s_SQLPart2[i]);
|
635 |
665 |
for (int i = 0; i < s_SQLPart3.Length; i++) wrkFormat.Append(s_SQLPart3[i]);
|
|
666 |
for (int i = 0; i < s_SQLPart3_1.Length; i++) wrkFormat.Append(s_SQLPart3_1[i]);
|
636 |
667 |
|
637 |
|
wrkFormat.Append(" LEFT JOIN processapproval AS App ON App.ConstructionCode = A.ConstructionCode");
|
638 |
|
wrkFormat.AppendFormat(" AND App.ApprovalCode = {0}", (int)ClsExcute.ApprovalListNo.ConstructionBudgetApproval);
|
639 |
|
wrkFormat.AppendFormat(" And App.OrderNo = {0}", CommonDefine.s_Default_OrderNo);
|
640 |
|
wrkFormat.Append(" And App.SeqNo = 1");
|
|
668 |
wrkFormat.Append(s_SQLPart3_2[0]);
|
|
669 |
wrkFormat.Append(s_SQLPart3_2[1]);
|
|
670 |
wrkFormat.AppendFormat(s_SQLPart3_2[2], (int)ClsExcute.ApprovalListNo.ConstructionBudgetApproval);
|
|
671 |
wrkFormat.AppendFormat(s_SQLPart3_2[3], CommonDefine.s_Default_OrderNo);
|
|
672 |
wrkFormat.Append(s_SQLPart3_2[4]);
|
641 |
673 |
|
642 |
674 |
wrkFormat.Append(", constructionbudget E");
|
643 |
|
for (int i = 0; i < s_SQLPart4.Length; i++) wrkFormat.Append(s_SQLPart4[i]);
|
|
675 |
for (int i = 0; i < s_SQLPart5.Length; i++) wrkFormat.Append(s_SQLPart5[i]);
|
644 |
676 |
wrkFormat.Append(" AND A.CONSTRUCTIONPERSONCODE != 0");
|
645 |
677 |
|
646 |
678 |
strSQL.AppendFormat(wrkFormat.ToString(), numUDConstPro.Value);
|
... | ... | |
693 |
725 |
|
694 |
726 |
StringBuilder wrkFormat = new StringBuilder();
|
695 |
727 |
for (int i = 0; i < s_SQLPart1.Length; i++) wrkFormat.Append(s_SQLPart1[i]);
|
696 |
|
wrkFormat.Append(", -1, 0"); // ???t?B?[???h???????????
|
697 |
|
for (int i = 0; i < s_SQLPart1_1.Length; i++) wrkFormat.Append(s_SQLPart1_1[i]);
|
|
728 |
wrkFormat.Append(s_SQLPart1_1[0]);
|
|
729 |
for (int i = 0; i < s_SQLPart2.Length; i++) wrkFormat.Append(s_SQLPart2[i]);
|
698 |
730 |
|
699 |
|
for (int i = 0; i < s_SQLPart2.Length; i++) wrkFormat.Append(s_SQLPart2[i]);
|
700 |
731 |
for (int i = 0; i < s_SQLPart3.Length; i++) wrkFormat.Append(s_SQLPart3[i]);
|
|
732 |
for (int i = 0; i < s_SQLPart3_1.Length; i++) wrkFormat.Append(s_SQLPart3_1[i]);
|
701 |
733 |
|
702 |
|
wrkFormat.Append(", PROCESSAPPROVAL A1");
|
703 |
|
for (int i = 0; i < s_SQLPart4.Length; i++) wrkFormat.Append(s_SQLPart4[i]);
|
|
734 |
wrkFormat.Append(", PROCESSAPPROVAL App");
|
|
735 |
for (int i = 0; i < s_SQLPart5.Length; i++) wrkFormat.Append(s_SQLPart5[i]);
|
704 |
736 |
|
705 |
737 |
strSQL.AppendFormat(wrkFormat.ToString(), numUDConstPro.Value);
|
706 |
738 |
|
... | ... | |
725 |
757 |
strSQL.Append(" GROUP BY AA1.CONSTRUCTIONCODE, AA1.COMPANYCODE");
|
726 |
758 |
|
727 |
759 |
strSQL.AppendFormat(" HAVING SUM(AA1.EXECUTIONAMOUNT) >= {0}))", CommonDefine.s_PrintOutPrice);
|
728 |
|
strSQL.Append(" AND (A1.CONSTRUCTIONCODE = A.CONSTRUCTIONCODE");
|
729 |
|
strSQL.AppendFormat(" AND A1.APPROVALCODE = {0}", (int)ClsExcute.ApprovalListNo.ConstructionBudgetApproval);
|
730 |
|
strSQL.Append(" AND A1.SEQNO = 1");
|
731 |
|
strSQL.AppendFormat(" AND A1.APPROVALSTATUS = {0})", (int)CommonDefine.ApprovalStatus.Approval);
|
|
760 |
|
|
761 |
// Left Join???????????????
|
|
762 |
strSQL.Append(" And (");
|
|
763 |
strSQL.Append(s_SQLPart3_2[1]);
|
|
764 |
strSQL.AppendFormat(s_SQLPart3_2[2], (int)ClsExcute.ApprovalListNo.ConstructionBudgetApproval);
|
|
765 |
strSQL.AppendFormat(s_SQLPart3_2[3], CommonDefine.s_Default_OrderNo);
|
|
766 |
strSQL.Append(s_SQLPart3_2[4]);
|
|
767 |
strSQL.AppendFormat(" And App.ApprovalStatus = {0}", (int)CommonDefine.ApprovalStatus.Approval);
|
|
768 |
strSQL.Append(") ");
|
|
769 |
|
732 |
770 |
strSQL.Append(" OR A.JOINFLG = 1)");
|
733 |
771 |
|
734 |
772 |
// ???????I???????????
|
... | ... | |
742 |
780 |
|
743 |
781 |
wrkFormat.Clear();
|
744 |
782 |
for (int i = 0; i < s_SQLPart1.Length; i++) wrkFormat.Append(s_SQLPart1[i]);
|
745 |
|
wrkFormat.Append(", ifnull(App.ApprovalStatus, -1)");
|
746 |
|
wrkFormat.Append(", ifnull(App.OrderNo, 0)");
|
747 |
|
for (int i = 0; i < s_SQLPart1_1.Length; i++) wrkFormat.Append(s_SQLPart1_1[i]);
|
|
783 |
wrkFormat.Append(s_SQLPart1_2[0]);
|
|
784 |
for (int i = 0; i < s_SQLPart2.Length; i++) wrkFormat.Append(s_SQLPart2[i]);
|
748 |
785 |
|
749 |
|
for (int i = 0; i < s_SQLPart2.Length; i++) wrkFormat.Append(s_SQLPart2[i]);
|
750 |
786 |
for (int i = 0; i < s_SQLPart3.Length; i++) wrkFormat.Append(s_SQLPart3[i]);
|
|
787 |
for (int i = 0; i < s_SQLPart3_1.Length; i++) wrkFormat.Append(s_SQLPart3_1[i]);
|
751 |
788 |
|
752 |
|
wrkFormat.Append(" LEFT JOIN processapproval AS App");
|
753 |
|
wrkFormat.Append(" ON App.ConstructionCode = A.ConstructionCode");
|
754 |
|
wrkFormat.AppendFormat(" AND App.ApprovalCode = {0}", (int)ClsExcute.ApprovalListNo.PurchaseOrderEntryApproval);
|
755 |
|
wrkFormat.AppendFormat(" And App.OrderNo = {0}", CommonDefine.s_Default_OrderNo);
|
756 |
|
wrkFormat.Append(" And App.SeqNo = 1");
|
|
789 |
wrkFormat.Append(s_SQLPart3_2[0]);
|
|
790 |
wrkFormat.Append(s_SQLPart3_2[1]);
|
|
791 |
wrkFormat.AppendFormat(s_SQLPart3_2[2], (int)ClsExcute.ApprovalListNo.PurchaseOrderEntryApproval);
|
|
792 |
wrkFormat.AppendFormat(s_SQLPart3_2[3], CommonDefine.s_Default_OrderNo);
|
|
793 |
wrkFormat.Append(s_SQLPart3_2[4]);
|
757 |
794 |
|
758 |
795 |
wrkFormat.Append(", PURCHASEORDER A1");
|
759 |
|
for (int i = 0; i < s_SQLPart4.Length; i++) wrkFormat.Append(s_SQLPart4[i]);
|
|
796 |
for (int i = 0; i < s_SQLPart5.Length; i++) wrkFormat.Append(s_SQLPart5[i]);
|
760 |
797 |
|
761 |
798 |
strSQL.Append(" UNION (");
|
762 |
799 |
strSQL.AppendFormat(wrkFormat.ToString(), numUDConstPro.Value);
|
... | ... | |
804 |
841 |
{
|
805 |
842 |
try
|
806 |
843 |
{
|
807 |
|
// ???????????F???????????
|
808 |
|
int ApprovalCode = ClsExcute.AppovalList.First(x => x.Value.Equals("?????????F")).Key;
|
809 |
|
|
810 |
844 |
// ?Z?L?????e?B???????
|
811 |
845 |
StringBuilder wrkBuff = new StringBuilder();
|
812 |
846 |
CreateSecuritySQL(ref wrkBuff);
|
813 |
847 |
|
814 |
848 |
StringBuilder wrkFormat = new StringBuilder();
|
815 |
849 |
for (int i = 0; i < s_SQLPart1.Length; i++) wrkFormat.Append(s_SQLPart1[i]);
|
816 |
|
wrkFormat.Append(", DATE_FORMAT(A2.PRINTOUTDATE, '%Y/%m/%d'), A1.ORDERNO"); // ???t?B?[???h???????????
|
817 |
|
for (int i = 0; i < s_SQLPart1_1.Length; i++) wrkFormat.Append(s_SQLPart1_1[i]);
|
|
850 |
wrkFormat.Append(s_SQLPart1_2[0]);
|
|
851 |
wrkFormat.Append(", DATE_FORMAT(A2.PRINTOUTDATE, '%Y/%m/%d')"); // ???t?B?[???h???????????
|
|
852 |
for (int i = 0; i < s_SQLPart2.Length; i++) wrkFormat.Append(s_SQLPart2[i]);
|
818 |
853 |
|
819 |
|
for (int i = 0; i < s_SQLPart2.Length; i++) wrkFormat.Append(s_SQLPart2[i]);
|
820 |
854 |
for (int i = 0; i < s_SQLPart3.Length; i++) wrkFormat.Append(s_SQLPart3[i]);
|
821 |
|
wrkFormat.Append(", PROCESSAPPROVAL A1, PURCHASEORDER A2");
|
822 |
|
for (int i = 0; i < s_SQLPart4.Length; i++) wrkFormat.Append(s_SQLPart4[i]);
|
|
855 |
for (int i = 0; i < s_SQLPart3_1.Length; i++) wrkFormat.Append(s_SQLPart3_1[i]);
|
|
856 |
wrkFormat.Append(", PROCESSAPPROVAL App, PURCHASEORDER A2");
|
|
857 |
for (int i = 0; i < s_SQLPart5.Length; i++) wrkFormat.Append(s_SQLPart5[i]);
|
823 |
858 |
|
824 |
859 |
strSQL.AppendFormat(wrkFormat.ToString(), numUDConstPro.Value);
|
825 |
860 |
strSQL.Append(" AND EXISTS (SELECT * FROM PURCHASEORDER B1 WHERE B1.CONSTRUCTIONCODE = A.CONSTRUCTIONCODE)");
|
826 |
|
strSQL.AppendFormat(" And (A.ConstructionCode = A1.ConstructionCode And A1.ApprovalCode = {0} And A1.SeqNo = 1 And A1.APPROVALSTATUS = {1})",
|
827 |
|
ApprovalCode, (int)CommonDefine.ApprovalStatus.Approval);
|
|
861 |
|
|
862 |
// Left Join???????????????
|
|
863 |
strSQL.Append(" And (");
|
|
864 |
strSQL.Append(s_SQLPart3_2[1]);
|
|
865 |
strSQL.AppendFormat(s_SQLPart3_2[2], (int)ClsExcute.ApprovalListNo.PurchaseOrderEntryApproval);
|
|
866 |
//strSQL.AppendFormat(s_SQLPart3_2[3], CommonDefine.s_Default_OrderNo);
|
|
867 |
strSQL.Append(s_SQLPart3_2[4]);
|
|
868 |
strSQL.AppendFormat(" And App.ApprovalStatus = {0}", (int)CommonDefine.ApprovalStatus.Approval);
|
|
869 |
strSQL.Append(") ");
|
|
870 |
|
828 |
871 |
strSQL.Append(" AND (A.CONSTRUCTIONCODE = A2.CONSTRUCTIONCODE AND A2.SEQNO = 1)");
|
829 |
872 |
|
830 |
873 |
// ???????I???????????
|
... | ... | |
869 |
912 |
|
870 |
913 |
StringBuilder wrkFormat = new StringBuilder();
|
871 |
914 |
for (int i = 0; i < s_SQLPart1.Length; i++) wrkFormat.Append(s_SQLPart1[i]);
|
872 |
|
wrkFormat.Append(", ifnull(App.ApprovalStatus, -1), ifnull(App.OrderNo, 0)");
|
873 |
|
for (int i = 0; i < s_SQLPart1_1.Length; i++) wrkFormat.Append(s_SQLPart1_1[i]);
|
|
915 |
wrkFormat.Append(s_SQLPart1_2[0]);
|
|
916 |
for (int i = 0; i < s_SQLPart2.Length; i++) wrkFormat.Append(s_SQLPart2[i]);
|
874 |
917 |
|
875 |
|
for (int i = 0; i < s_SQLPart2.Length; i++) wrkFormat.Append(s_SQLPart2[i]);
|
876 |
918 |
for (int i = 0; i < s_SQLPart3.Length; i++) wrkFormat.Append(s_SQLPart3[i]);
|
|
919 |
for (int i = 0; i < s_SQLPart3_1.Length; i++) wrkFormat.Append(s_SQLPart3_1[i]);
|
877 |
920 |
|
878 |
|
wrkFormat.Append(" LEFT JOIN processapproval AS App ON App.ConstructionCode = A.ConstructionCode");
|
879 |
|
wrkFormat.AppendFormat(" AND App.ApprovalCode = {0}", (int)ClsExcute.ApprovalListNo.EstimateBudgetApproval);
|
880 |
|
wrkFormat.AppendFormat(" And App.OrderNo = {0}", CommonDefine.s_Default_OrderNo);
|
881 |
|
wrkFormat.Append(" And App.SeqNo = 1");
|
|
921 |
wrkFormat.Append(s_SQLPart3_2[0]);
|
|
922 |
wrkFormat.Append(s_SQLPart3_2[1]);
|
|
923 |
wrkFormat.AppendFormat(s_SQLPart3_2[2], (int)ClsExcute.ApprovalListNo.EstimateBudgetApproval);
|
|
924 |
wrkFormat.AppendFormat(s_SQLPart3_2[3], CommonDefine.s_Default_OrderNo);
|
|
925 |
wrkFormat.Append(s_SQLPart3_2[4]);
|
882 |
926 |
|
883 |
927 |
wrkFormat.Append(", constructionledger AS Ledger");
|
884 |
928 |
|
885 |
|
for (int i = 0; i < s_SQLPart4.Length; i++) wrkFormat.Append(s_SQLPart4[i]);
|
|
929 |
for (int i = 0; i < s_SQLPart5.Length; i++) wrkFormat.Append(s_SQLPart5[i]);
|
886 |
930 |
|
887 |
931 |
wrkFormat.AppendFormat(" AND ({0} <= A.CONSTRUCTIONSTATUSFLG AND A.CONSTRUCTIONSTATUSFLG <= {1})", nStat1, nStat2);
|
888 |
932 |
wrkFormat.Append(" AND Ledger.ConstructionCode = A.ConstructionCode");
|
... | ... | |
901 |
945 |
strSQL.Append(wrkBuff);
|
902 |
946 |
|
903 |
947 |
// ORDER BY ???
|
904 |
|
for (int i = 0; i < s_SQLPart5.Length; i++) strSQL.Append(s_SQLPart5[i]);
|
|
948 |
for (int i = 0; i < s_SQLPart6.Length; i++) strSQL.Append(s_SQLPart6[i]);
|
905 |
949 |
}
|
906 |
950 |
catch (Exception ex)
|
907 |
951 |
{
|
... | ... | |
1281 |
1325 |
{
|
1282 |
1326 |
int nConstrCode = CommonMotions.cnvInt(objwrk[(int)GetData.CONSTRUCTIONCODE]);
|
1283 |
1327 |
int nOrderNo = CommonMotions.cnvInt(objwrk[(int)GetData.ORDERNO]);
|
|
1328 |
int nJoinFlg = CommonMotions.cnvInt(objwrk[(int)GetData.JOINFLG]);
|
|
1329 |
int nTyingFlg = CommonMotions.cnvInt(objwrk[(int)GetData.TYINGFLG]);
|
1284 |
1330 |
int nAppStatus = 0;
|
1285 |
1331 |
string strAppStatus = string.Empty;
|
1286 |
1332 |
DateTime dtAppStatus = DateTime.MinValue;
|
1287 |
1333 |
|
1288 |
1334 |
// ----- ?N?????????????
|
1289 |
|
int ParentCode = ClsProcessExist.GetParentConstrCode(nConstrCode);
|
|
1335 |
int ParentCode = ClsProcessExist.GetParentConstrCode(nConstrCode, nJoinFlg, nTyingFlg);
|
1290 |
1336 |
switch (m_ExecuteFlg)
|
1291 |
1337 |
{
|
1292 |
1338 |
case (int)ClsExcute.ProcessExecuteNo.EstimateInput: // ??Z?????????
|