プロジェクト

全般

プロフィール

リビジョン 231

山内7年以上前に追加

請求まとめ(暫定:承認申請画面の承認対象データを見るからの一覧表示)

差分を表示:

branches/src/ProcessManagement/ProcessManagement/Common/Process/ClsExcute.cs
303 303
            /// </summary>
304 304
            SubConstregistApproval,
305 305
            /// <summary>
306
            /// 98:手間支払
306
            /// 11:手間支払
307 307
            /// </summary>
308
            FeePayment = 98,
308
            FeePayment,
309 309
            /// <summary>
310
            /// 99:業者支払
310
            /// 12:業者支払
311 311
            /// </summary>
312
            SubConstrPayment = 99,
312
            SubConstrPayment,
313 313
        }
314 314
        #endregion
315 315

  
......
350 350
                                                                                {10, "協力会社登録承認"},
351 351
                                                                                {11, "手間支払確認承認"},
352 352
                                                                                {12, "業社支払確認承認"},
353
                                                                                {98, "入金確認承認"},
354
                                                                                {99, "請求まとめ承認"}
355 353
                                                                                };
356 354

  
357 355
        #endregion
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Request/RequestSummaryList/FrmRequestSummaryList.cs
723 723
            StringBuilder sql;
724 724
            List<ShoninData> lstDefaultShonin = new List<ShoninData>();
725 725
            List<PaymentApprovalInfo> PaIList = new List<PaymentApprovalInfo>();
726
            PaymentApprovalInfo PaInfo = null;
726 727

  
727 728
            IOConstructionBaseInfo IoCbi = new IOConstructionBaseInfo();
728 729
            IOMPersonInCharge IoMpic = new IOMPersonInCharge();
......
731 732
            string KojiTanto = "", KojiTantoCode = "";
732 733
            int ConstrDepartmentCode = 0;
733 734

  
735
            // ?N??????m?F // TODO
736
            if (ClsExcute.ProcControlPara.Count > 0)
737
            {
738
                for (int i = 0; i < ClsExcute.ProcControlPara.Count; i++)
739
                {
740
                    if ((ClsExcute.ProcControlPara[i].ArrayParameter != null) && (ClsExcute.ProcControlPara[i].ArrayParameter.Count > 0))
741
                    {
742
                        ArrayList obj = ClsExcute.ProcControlPara[i].ArrayParameter[0];
743
                        PaInfo = (PaymentApprovalInfo)obj[0];
744
                        if (PaInfo is PaymentApprovalInfo != true)
745
                        {
746
                            PaInfo = null;
747
                        }
748
                    }
749
                }
750
            }
751

  
734 752
            try
735 753
            {
736 754

  
......
761 779

  
762 780
                // SQL??
763 781
                sql = new StringBuilder();
764
                sql.Append("select ");
765
                sql.Append("  ifnull(Bd.SeqNo, 1) as SeqNo ");
766
                sql.Append("  , ifnull(Bdd.LineCount, 0) as LineCount ");
767
                sql.Append("  , ifnull(Bdd.CompanyCode, Cld.CompanyCode) as CompanyCode ");
768
                sql.Append("  , ifnull(Scm.CompanyName, Cld.CompanyName) as CompanyName ");
769
                sql.Append("  , Sc.DisplayOrder as DisplayOrder ");
770
                sql.Append("  , ifnull(Bdd.ConstructionCode, Cl.ConstructionCode) as ConstructionCode ");
771
                sql.Append("  , ifnull(Bdd.FieldName, Cbd.DetailString) as FieldName ");
772
                sql.Append("  , Bdd.BillPrice as BillPrice ");
773
                sql.Append("  , Bdd.HighwPrice as HighwPrice ");
774
                sql.Append("  , Bdd.HardwPrice as HardwPrice ");
775
                sql.Append("  , Bdd.IndswasteTax as IndswasteTax ");
776
                sql.Append("  , DATE_FORMAT(Bdd.UpdateDate, '%Y/%m/%d %H:%i:%s') as UpdateDate ");
777
                sql.Append("  , ifnull(Bdd.Note, '') as Bikou ");
778
                sql.Append("  , ifnull(Pdd.BillPrice, 0) as KojiSeikyu ");
779
                sql.Append("  , ifnull(Pdd.DiscountPrice, 0) as KojiNebiki ");
780
                sql.Append("  , ifnull(Pdd.OffsetPrice, 0) as KojiSousai ");
781
                sql.Append("  , ifnull(Pdd.NextCoPrice, 0) as JikaiKurikosi ");
782
                sql.Append("  , ifnull(Pdd.HighwPrice, 0) as KojiKousoku ");
783
                sql.Append("  , ifnull(Pdd.HardwPrice, 0) as KojiKanamono ");
784
                sql.Append("  , ifnull(Pdd.IndswasteTax, 0) as KojiSannhaiZei ");
785
                sql.Append("  , ifnull(Pdd.CnstrPrice, 0) as CnstrPrice ");
786
                sql.Append("  , ifnull(Pdd.CnstrPriceExist, - 1) as CnstrPriceExist ");
787
                sql.Append("  , ifnull(Pdd.ApprovalPersonCode, 0) as ApprovalPersonCode ");
788
                sql.Append("  , ifnull(Picm.SealPrintName, '') as TantoNM ");
789
                sql.Append("  , DATE_FORMAT( ");
790
                sql.Append("    ifnull(Pdd.ApprovalDate, '2001/01/01') ");
791
                sql.Append("    , '%Y/%m/%d' ");
792
                sql.Append("  ) as ApprovalDate ");
793
                sql.Append("  , ifnull(Pdd.ApprovalEndFlg, 0) as ApprovalEndFlg ");
794
                sql.Append("  , ifnull(Cbi.SalesPersonCode, 0) as SalesPersonCode ");
795
                sql.Append("  , ifnull(Cbi.ConstructionPersonCode, 0) as ConstructionPersonCode ");
796
                sql.Append("  , ifnull(Cbi.ConstrSubPersonCode, 0) as ConstrSubPersonCode ");
797
                sql.Append("  , ifnull(Cbi.ConstructionInstructor, 0) as ConstructionInstructor ");
798
                sql.Append("  , Picm2.DepartmentCode ");
799
                sql.Append("  , case ifnull(Pod.SendDate, '') ");
800
                sql.Append("    when '' then '?~' ");
801
                sql.Append("    when '2001/01/01' then '?~' ");
802
                sql.Append("    else '??' ");
803
                sql.Append("    end as PurchaseOrderMailingDate ");
804
                sql.Append("  , case ifnull(Pod.ReturnCheckDate, '') ");
805
                sql.Append("    when '' then '?~' ");
806
                sql.Append("    when '2001/01/01' then '?~' ");
807
                sql.Append("    else '??' ");
808
                sql.Append("    end as PurchaseOrderReturnDate ");
809
                sql.Append("  , case ifnull(Pa.PersonCode, 0) ");
810
                sql.Append("    when 0 then case Cld.ConstructionCode ");
811
                sql.Append("      when 0 then '' ");
812
                sql.Append("      else '?~' ");
813
                sql.Append("      end ");
814
                sql.Append("    else '??' ");
815
                sql.Append("    end as PaData ");
816
                sql.Append("  , Cld.LineCount as LinePoint ");
817
                sql.AppendFormat("  , PERIOD_DIFF({0} ,DATE_FORMAT(Cl.ConstructionStart, '%Y%m')) + {1} AS ColPoint ", m_Select_TargetDate, Enum.GetNames(typeof(FrmConstructionLedger.GridColumn)).Length - 1);
818
                sql.Append("from ");
819
                sql.Append("  ConstructionLedgerDetail as Cld ");
820
                sql.Append("  inner join ConstructionLedger as Cl on Cl.ConstructionCode = Cld.ConstructionCode ");
821
                sql.Append("    and Cl.ComplateFlg = 0 ");
822
                sql.Append("  inner join ConstructionBaseinfoDetail as Cbd on Cbd.ConstructionCode = Cld.ConstructionCode ");
823
                sql.Append("    and Cbd.DetailNo = 2 ");
824
                sql.Append("  inner join SubContractorMaster as Sc on Sc.COMPANYCODE = Cld.CompanyCode ");
825
                sql.AppendFormat("  and Sc.LABOURKIND = {0} ", m_Labourkind);
826
                sql.Append("  left join ConstructionLedgerExcute AS Cle on Cle.ConstructionCode = Cld.ConstructionCode ");
827
                sql.Append("  and Cle.GroupCount = Cld.GroupCount ");
828
                sql.Append("  and Cle.LineCount = Cld.LineCount ");
829
                sql.AppendFormat("    and Cle.ColumnCount = (PERIOD_DIFF({0} ,DATE_FORMAT(CL.ConstructionStart, '%Y%m')) + {1}) ", m_Select_TargetDate, Enum.GetNames(typeof(FrmConstructionLedger.GridColumn)).Length - 1);
830
                sql.Append("  left join ( ");
831
                sql.Append("  BillingData as Bd join ( ");
832
                sql.Append("    BillingDataDetail as Bdd join SubContractorMaster as Scm ");
833
                sql.Append("      on Bdd.CompanyCode = Scm.CompanyCode ");
834
                sql.AppendFormat("      and Scm.LabourKind = {0} ", m_Labourkind);
835
                sql.Append("      left join ( ");
836
                sql.Append("        PaymentDataDetail as Pdd ");
837
                sql.Append("          left join PersonInChargeMaster as Picm ");
838
                sql.Append("            on ifnull(Pdd.ApprovalPersonCode, - 1) = Picm.PersonCode ");
839
                sql.Append("      ) ");
840
                sql.Append("        on Bdd.CompanyCode = Pdd.CompanyCode ");
841
                sql.Append("        and Bdd.TargetDate = Pdd.TargetDate ");
842
                sql.Append("        and Bdd.SeqNo = Pdd.SeqNo ");
843
                sql.Append("        and Bdd.LineCount = Pdd.LineCount ");
844
                sql.Append("  ) ");
845
                sql.Append("       on Bd.CompanyCode = BdD.CompanyCode ");
846
                sql.Append("       and Bd.TargetDate = BdD.TargetDate ");
847
                sql.Append("       and Bd.SeqNo = BdD.SeqNo ");
848
                sql.AppendFormat("       and Bd.TargetDate = {0} ", m_Select_TargetDate);
849
                sql.Append("  ) on Bd.COMPANYCODE = Cld.CompanyCode ");
850
                sql.Append("  and Bdd.ConstructionCode = Cld.ConstructionCode ");
851
                sql.Append("  left join ( ");
852
                sql.Append("    PurchaseOrderDate as Pod ");
853
                sql.Append("  ) on Cld.CompanyCode = Pod.CompanyCode ");
854
                sql.Append("  and Cld.ConstructionCode = Pod.ConstructionCode ");
855
                sql.Append("  left join ( ");
856
                sql.Append("    ConstructionBaseInfo as Cbi ");
857
                sql.Append("      left join ( ");
858
                sql.Append("        PersonInChargeMaster as Picm2 ");
859
                sql.Append("          left join ApprovalMaster as Am ");
860
                sql.Append("            on Picm2.DepartmentCode = Am.DepartmentCode ");
861
                sql.Append("            and Am.ApprovalCode = 3 ");
862
                sql.Append("            and ApprovalAuthority = 1 ");
863
                sql.Append("      ) ");
864
                sql.Append("        on Cbi.ConstructionPersonCode = Picm2.PersonCode ");
865
                sql.Append("      left join ProcessApproval as Pa ");
866
                sql.Append("        on Cbi.ConstructionCode = Pa.ConstructionCode ");
867
                sql.Append("        and Am.ApprovalPerson = Pa.PersonCode ");
868
                sql.Append("        and Pa.SeqNo > 1 ");
869
                sql.Append("        and Pa.ApprovalStatus = 2 ");
870
                sql.Append("  ) ");
871
                sql.Append("    on Cld.ConstructionCode = Cbi.ConstructionCode ");
782
                if (PaInfo != null)
783
                {
784
                    sql.Append("select ");
785
                    sql.Append("  ifnull(Bd.SeqNo, 1) as SeqNo ");
786
                    sql.Append("  , ifnull(Bdd.LineCount, 0) as LineCount ");
787
                    sql.Append("  , ifnull(Bdd.CompanyCode, 0) as CompanyCode ");
788
                    sql.Append("  , ifnull(Scm.CompanyName, \"\") as CompanyName ");
789
                    sql.Append("  , Scm.DisplayOrder as DisplayOrder ");
790
                    sql.Append("  , Bdd.ConstructionCode as ConstructionCode ");
791
                    sql.Append("  , Bdd.FieldName as FieldName ");
792
                    sql.Append("  , Bdd.BillPrice as BillPrice ");
793
                    sql.Append("  , Bdd.HighwPrice as HighwPrice ");
794
                    sql.Append("  , Bdd.HardwPrice as HardwPrice ");
795
                    sql.Append("  , Bdd.IndswasteTax as IndswasteTax ");
796
                    sql.Append("  , DATE_FORMAT(Bdd.UpdateDate, '%Y/%m/%d %H:%i:%s') as UpdateDate ");
797
                    sql.Append("  , ifnull(Bdd.Note, '') as Bikou ");
798
                    sql.Append("  , ifnull(Pdd.BillPrice, 0) as KojiSeikyu ");
799
                    sql.Append("  , ifnull(Pdd.DiscountPrice, 0) as KojiNebiki ");
800
                    sql.Append("  , ifnull(Pdd.OffsetPrice, 0) as KojiSousai ");
801
                    sql.Append("  , ifnull(Pdd.NextCoPrice, 0) as JikaiKurikosi ");
802
                    sql.Append("  , ifnull(Pdd.HighwPrice, 0) as KojiKousoku ");
803
                    sql.Append("  , ifnull(Pdd.HardwPrice, 0) as KojiKanamono ");
804
                    sql.Append("  , ifnull(Pdd.IndswasteTax, 0) as KojiSannhaiZei ");
805
                    sql.Append("  , ifnull(Pdd.CnstrPrice, 0) as CnstrPrice ");
806
                    sql.Append("  , ifnull(Pdd.CnstrPriceExist, - 1) as CnstrPriceExist ");
807
                    sql.Append("  , ifnull(Pdd.ApprovalPersonCode, 0) as ApprovalPersonCode ");
808
                    sql.Append("  , ifnull(Picm.SealPrintName, '') as TantoNM ");
809
                    sql.Append("  , DATE_FORMAT( ");
810
                    sql.Append("    ifnull(Pdd.ApprovalDate, '2001/01/01') ");
811
                    sql.Append("    , '%Y/%m/%d' ");
812
                    sql.Append("  ) as ApprovalDate ");
813
                    sql.Append("  , ifnull(Pdd.ApprovalEndFlg, 0) as ApprovalEndFlg ");
814
                    sql.Append("  , ifnull(Cbi.SalesPersonCode, 0) as SalesPersonCode ");
815
                    sql.Append("  , ifnull(Cbi.ConstructionPersonCode, 0) as ConstructionPersonCode ");
816
                    sql.Append("  , ifnull(Cbi.ConstrSubPersonCode, 0) as ConstrSubPersonCode ");
817
                    sql.Append("  , ifnull(Cbi.ConstructionInstructor, 0) as ConstructionInstructor ");
818
                    sql.Append("  , Picm2.DepartmentCode ");
819
                    sql.Append("  , case ifnull(Pod.SendDate, '') ");
820
                    sql.Append("    when '' then '?~' ");
821
                    sql.Append("    when '2001/01/01' then '?~' ");
822
                    sql.Append("    else '??' ");
823
                    sql.Append("    end as PurchaseOrderMailingDate ");
824
                    sql.Append("  , case ifnull(Pod.ReturnCheckDate, '') ");
825
                    sql.Append("    when '' then '?~' ");
826
                    sql.Append("    when '2001/01/01' then '?~' ");
827
                    sql.Append("    else '??' ");
828
                    sql.Append("    end as PurchaseOrderReturnDate ");
829
                    sql.Append("  , case ifnull(Pa.PersonCode, 0) ");
830
                    sql.Append("    when 0 then case Bdd.ConstructionCode ");
831
                    sql.Append("      when 0 then '' ");
832
                    sql.Append("      else '?~' ");
833
                    sql.Append("      end ");
834
                    sql.Append("    else '??' ");
835
                    sql.Append("    end as PaData ");
836
                    sql.Append("  , null as LinePoint ");
837
                    sql.Append("  , null as ColPoint ");
838
                    sql.Append("from ");
839
                    sql.Append("  BillingData as Bd join ( ");
840
                    sql.Append("    BillingDataDetail as Bdd join SubContractorMaster as Scm ");
841
                    sql.Append("      on Bdd.CompanyCode = Scm.CompanyCode ");
842
                    sql.AppendFormat("      and Scm.LabourKind = {0} ", m_Labourkind);
843
                    sql.Append("      left join ( ");
844
                    sql.Append("        PaymentDataDetail as Pdd ");
845
                    sql.Append("          left join PersonInChargeMaster as Picm ");
846
                    sql.Append("            on ifnull(Pdd.ApprovalPersonCode, - 1) = Picm.PersonCode ");
847
                    sql.Append("      ) ");
848
                    sql.Append("        on Bdd.CompanyCode = Pdd.CompanyCode ");
849
                    sql.Append("        and Bdd.TargetDate = Pdd.TargetDate ");
850
                    sql.Append("        and Bdd.SeqNo = Pdd.SeqNo ");
851
                    sql.Append("        and Bdd.LineCount = Pdd.LineCount ");
852
                    sql.Append("      left join ( ");
853
                    sql.Append("        ConstructionBaseInfo as Cbi ");
854
                    sql.Append("          left join ( ");
855
                    sql.Append("            PersonInChargeMaster as Picm2 ");
856
                    sql.Append("              left join ApprovalMaster as Am ");
857
                    sql.Append("                on Picm2.DepartmentCode = Am.DepartmentCode ");
858
                    sql.Append("                and Am.ApprovalCode = 3 ");
859
                    sql.Append("                and ApprovalAuthority = 1 ");
860
                    sql.Append("          ) ");
861
                    sql.Append("            on Cbi.ConstructionPersonCode = Picm2.PersonCode ");
862
                    sql.Append("          left join ProcessApproval as Pa ");
863
                    sql.Append("            on Cbi.ConstructionCode = Pa.ConstructionCode ");
864
                    sql.Append("            and Am.ApprovalPerson = Pa.PersonCode ");
865
                    sql.Append("            and Pa.SeqNo > 1 ");
866
                    sql.Append("            and Pa.ApprovalStatus = 2 ");
867
                    sql.Append("      ) ");
868
                    sql.Append("        on Bdd.ConstructionCode = Cbi.ConstructionCode ");
869
                    sql.Append("  ) ");
870
                    sql.Append("       on Bd.CompanyCode = Bdd.CompanyCode ");
871
                    sql.Append("       and Bd.TargetDate = Bdd.TargetDate ");
872
                    sql.Append("       and Bd.SeqNo = Bdd.SeqNo ");
873
                    sql.AppendFormat(" and Bd.TargetDate = {0} ", PaInfo.TargetDate);
874
                    sql.Append("  left join ( ");
875
                    sql.Append("    PurchaseOrderDate as Pod ");
876
                    sql.Append("  ) on Bd.CompanyCode = Pod.CompanyCode ");
877
                    sql.Append("  and Bdd.ConstructionCode = Pod.ConstructionCode ");
878

  
879
                    sql.Append(" ");
880

  
881
                    sql.Append("group by ");
882
                    sql.Append("  SeqNo ");
883
                    sql.Append("  , LineCount ");
884
                    sql.Append("  , CompanyCode ");
885
                    sql.Append("  , CompanyName ");
886
                    sql.Append("  , DisplayOrder ");
887
                    sql.Append("  , ConstructionCode ");
888
                    sql.Append("  , FieldName ");
889
                    sql.Append("  , BillPrice ");
890
                    sql.Append("  , HighwPrice ");
891
                    sql.Append("  , Hardwprice ");
892
                    sql.Append("  , IndswasteTax ");
893
                    sql.Append("  , UpdateDate ");
894
                    sql.Append("  , Bikou ");
895
                    sql.Append("  , KojiSeikyu ");
896
                    sql.Append("  , KojiNebiki ");
897
                    sql.Append("  , KojiSousai ");
898
                    sql.Append("  , JikaiKurikosi ");
899
                    sql.Append("  , KojiKousoku ");
900
                    sql.Append("  , KojiKanamono ");
901
                    sql.Append("  , KojiSannhaiZei ");
902
                    sql.Append("  , CnstrPrice ");
903
                    sql.Append("  , CnstrpriceExist ");
904
                    sql.Append("  , ApprovalPersonCode ");
905
                    sql.Append("  , TantoNM ");
906
                    sql.Append("  , ApprovalDate ");
907
                    sql.Append("  , ApprovalEndFlg ");
908
                    sql.Append("  , SalesPersonCode ");
909
                    sql.Append("  , ConstructionPersonCode ");
910
                    sql.Append("  , ConstrSubPersonCode ");
911
                    sql.Append("  , ConstructionInstructor ");
912
                    sql.Append("  , DepartmentCode ");
913
                    sql.Append("  , PurchaseOrderMailingDate ");
914
                    sql.Append("  , PurchaseOrderReturnDate ");
915
                    sql.Append("  , PaData ");
916
                    sql.Append("  , LinePoint ");
917
                    sql.Append("  , ColPoint ");
918
                }
919
                else 
920
                {
921
                    sql.Append("select ");
922
                    sql.Append("  ifnull(Bd.SeqNo, 1) as SeqNo ");
923
                    sql.Append("  , ifnull(Bdd.LineCount, 0) as LineCount ");
924
                    sql.Append("  , ifnull(Bdd.CompanyCode, Cld.CompanyCode) as CompanyCode ");
925
                    sql.Append("  , ifnull(Scm.CompanyName, Cld.CompanyName) as CompanyName ");
926
                    sql.Append("  , Sc.DisplayOrder as DisplayOrder ");
927
                    sql.Append("  , ifnull(Bdd.ConstructionCode, Cl.ConstructionCode) as ConstructionCode ");
928
                    sql.Append("  , ifnull(Bdd.FieldName, Cbd.DetailString) as FieldName ");
929
                    sql.Append("  , Bdd.BillPrice as BillPrice ");
930
                    sql.Append("  , Bdd.HighwPrice as HighwPrice ");
931
                    sql.Append("  , Bdd.HardwPrice as HardwPrice ");
932
                    sql.Append("  , Bdd.IndswasteTax as IndswasteTax ");
933
                    sql.Append("  , DATE_FORMAT(Bdd.UpdateDate, '%Y/%m/%d %H:%i:%s') as UpdateDate ");
934
                    sql.Append("  , ifnull(Bdd.Note, '') as Bikou ");
935
                    sql.Append("  , ifnull(Pdd.BillPrice, 0) as KojiSeikyu ");
936
                    sql.Append("  , ifnull(Pdd.DiscountPrice, 0) as KojiNebiki ");
937
                    sql.Append("  , ifnull(Pdd.OffsetPrice, 0) as KojiSousai ");
938
                    sql.Append("  , ifnull(Pdd.NextCoPrice, 0) as JikaiKurikosi ");
939
                    sql.Append("  , ifnull(Pdd.HighwPrice, 0) as KojiKousoku ");
940
                    sql.Append("  , ifnull(Pdd.HardwPrice, 0) as KojiKanamono ");
941
                    sql.Append("  , ifnull(Pdd.IndswasteTax, 0) as KojiSannhaiZei ");
942
                    sql.Append("  , ifnull(Pdd.CnstrPrice, 0) as CnstrPrice ");
943
                    sql.Append("  , ifnull(Pdd.CnstrPriceExist, - 1) as CnstrPriceExist ");
944
                    sql.Append("  , ifnull(Pdd.ApprovalPersonCode, 0) as ApprovalPersonCode ");
945
                    sql.Append("  , ifnull(Picm.SealPrintName, '') as TantoNM ");
946
                    sql.Append("  , DATE_FORMAT( ");
947
                    sql.Append("    ifnull(Pdd.ApprovalDate, '2001/01/01') ");
948
                    sql.Append("    , '%Y/%m/%d' ");
949
                    sql.Append("  ) as ApprovalDate ");
950
                    sql.Append("  , ifnull(Pdd.ApprovalEndFlg, 0) as ApprovalEndFlg ");
951
                    sql.Append("  , ifnull(Cbi.SalesPersonCode, 0) as SalesPersonCode ");
952
                    sql.Append("  , ifnull(Cbi.ConstructionPersonCode, 0) as ConstructionPersonCode ");
953
                    sql.Append("  , ifnull(Cbi.ConstrSubPersonCode, 0) as ConstrSubPersonCode ");
954
                    sql.Append("  , ifnull(Cbi.ConstructionInstructor, 0) as ConstructionInstructor ");
955
                    sql.Append("  , Picm2.DepartmentCode ");
956
                    sql.Append("  , case ifnull(Pod.SendDate, '') ");
957
                    sql.Append("    when '' then '?~' ");
958
                    sql.Append("    when '2001/01/01' then '?~' ");
959
                    sql.Append("    else '??' ");
960
                    sql.Append("    end as PurchaseOrderMailingDate ");
961
                    sql.Append("  , case ifnull(Pod.ReturnCheckDate, '') ");
962
                    sql.Append("    when '' then '?~' ");
963
                    sql.Append("    when '2001/01/01' then '?~' ");
964
                    sql.Append("    else '??' ");
965
                    sql.Append("    end as PurchaseOrderReturnDate ");
966
                    sql.Append("  , case ifnull(Pa.PersonCode, 0) ");
967
                    sql.Append("    when 0 then case Cld.ConstructionCode ");
968
                    sql.Append("      when 0 then '' ");
969
                    sql.Append("      else '?~' ");
970
                    sql.Append("      end ");
971
                    sql.Append("    else '??' ");
972
                    sql.Append("    end as PaData ");
973
                    sql.Append("  , Cld.LineCount as LinePoint ");
974
                    sql.AppendFormat("  , PERIOD_DIFF({0} ,DATE_FORMAT(Cl.ConstructionStart, '%Y%m')) + {1} AS ColPoint ", m_Select_TargetDate, Enum.GetNames(typeof(FrmConstructionLedger.GridColumn)).Length - 1);
975
                    sql.Append("from ");
976
                    sql.Append("  ConstructionLedgerDetail as Cld ");
977
                    sql.Append("  inner join ConstructionLedger as Cl on Cl.ConstructionCode = Cld.ConstructionCode ");
978
                    sql.Append("    and Cl.ComplateFlg = 0 ");
979
                    sql.Append("  inner join ConstructionBaseinfoDetail as Cbd on Cbd.ConstructionCode = Cld.ConstructionCode ");
980
                    sql.Append("    and Cbd.DetailNo = 2 ");
981
                    sql.Append("  inner join SubContractorMaster as Sc on Sc.COMPANYCODE = Cld.CompanyCode ");
982
                    sql.AppendFormat("  and Sc.LABOURKIND = {0} ", m_Labourkind);
983
                    sql.Append("  left join ConstructionLedgerExcute AS Cle on Cle.ConstructionCode = Cld.ConstructionCode ");
984
                    sql.Append("  and Cle.GroupCount = Cld.GroupCount ");
985
                    sql.Append("  and Cle.LineCount = Cld.LineCount ");
986
                    sql.AppendFormat("    and Cle.ColumnCount = (PERIOD_DIFF({0} ,DATE_FORMAT(CL.ConstructionStart, '%Y%m')) + {1}) ", m_Select_TargetDate, Enum.GetNames(typeof(FrmConstructionLedger.GridColumn)).Length - 1);
987
                    sql.Append("  left join ( ");
988
                    sql.Append("  BillingData as Bd join ( ");
989
                    sql.Append("    BillingDataDetail as Bdd join SubContractorMaster as Scm ");
990
                    sql.Append("      on Bdd.CompanyCode = Scm.CompanyCode ");
991
                    sql.AppendFormat("      and Scm.LabourKind = {0} ", m_Labourkind);
992
                    sql.Append("      left join ( ");
993
                    sql.Append("        PaymentDataDetail as Pdd ");
994
                    sql.Append("          left join PersonInChargeMaster as Picm ");
995
                    sql.Append("            on ifnull(Pdd.ApprovalPersonCode, - 1) = Picm.PersonCode ");
996
                    sql.Append("      ) ");
997
                    sql.Append("        on Bdd.CompanyCode = Pdd.CompanyCode ");
998
                    sql.Append("        and Bdd.TargetDate = Pdd.TargetDate ");
999
                    sql.Append("        and Bdd.SeqNo = Pdd.SeqNo ");
1000
                    sql.Append("        and Bdd.LineCount = Pdd.LineCount ");
1001
                    sql.Append("  ) ");
1002
                    sql.Append("       on Bd.CompanyCode = BdD.CompanyCode ");
1003
                    sql.Append("       and Bd.TargetDate = BdD.TargetDate ");
1004
                    sql.Append("       and Bd.SeqNo = BdD.SeqNo ");
1005
                    sql.AppendFormat("       and Bd.TargetDate = {0} ", m_Select_TargetDate);
1006
                    sql.Append("  ) on Bd.COMPANYCODE = Cld.CompanyCode ");
1007
                    sql.Append("  and Bdd.ConstructionCode = Cld.ConstructionCode ");
1008
                    sql.Append("  left join ( ");
1009
                    sql.Append("    PurchaseOrderDate as Pod ");
1010
                    sql.Append("  ) on Cld.CompanyCode = Pod.CompanyCode ");
1011
                    sql.Append("  and Cld.ConstructionCode = Pod.ConstructionCode ");
1012
                    sql.Append("  left join ( ");
1013
                    sql.Append("    ConstructionBaseInfo as Cbi ");
1014
                    sql.Append("      left join ( ");
1015
                    sql.Append("        PersonInChargeMaster as Picm2 ");
1016
                    sql.Append("          left join ApprovalMaster as Am ");
1017
                    sql.Append("            on Picm2.DepartmentCode = Am.DepartmentCode ");
1018
                    sql.Append("            and Am.ApprovalCode = 3 ");
1019
                    sql.Append("            and ApprovalAuthority = 1 ");
1020
                    sql.Append("      ) ");
1021
                    sql.Append("        on Cbi.ConstructionPersonCode = Picm2.PersonCode ");
1022
                    sql.Append("      left join ProcessApproval as Pa ");
1023
                    sql.Append("        on Cbi.ConstructionCode = Pa.ConstructionCode ");
1024
                    sql.Append("        and Am.ApprovalPerson = Pa.PersonCode ");
1025
                    sql.Append("        and Pa.SeqNo > 1 ");
1026
                    sql.Append("        and Pa.ApprovalStatus = 2 ");
1027
                    sql.Append("  ) ");
1028
                    sql.Append("    on Cld.ConstructionCode = Cbi.ConstructionCode ");
872 1029
              
873
                sql.Append("where ");
874
                sql.Append("  Cld.GroupCount = 2 ");
875
                sql.Append("  and Cld.CompanyCode > 0 ");
876
                sql.AppendFormat("  and Cld.CompanyType = {0}", m_Labourkind);
1030
                    sql.Append("where ");
1031
                    sql.Append("  Cld.GroupCount = 2 ");
1032
                    sql.Append("  and Cld.CompanyCode > 0 ");
1033
                    sql.AppendFormat("  and Cld.CompanyType = {0}", m_Labourkind);
877 1034

  
878
                sql.Append(" ");
879
                sql.Append("union ");
880
                sql.Append(" ");
1035
                    sql.Append(" ");
1036
                    sql.Append("union ");
1037
                    sql.Append(" ");
881 1038

  
882
                sql.Append("select ");
883
                sql.Append("  ifnull(Bd.SeqNo, 1) as SeqNo ");
884
                sql.Append("  , ifnull(Bdd.LineCount, 0) as LineCount ");
885
                sql.Append("  , ifnull(Bdd.CompanyCode, 0) as CompanyCode ");
886
                sql.Append("  , ifnull(Scm.CompanyName, \"\") as CompanyName ");
887
                sql.Append("  , Scm.DisplayOrder as DisplayOrder ");
888
                sql.Append("  , Bdd.ConstructionCode as ConstructionCode ");
889
                sql.Append("  , Bdd.FieldName as FieldName ");
890
                sql.Append("  , Bdd.BillPrice as BillPrice ");
891
                sql.Append("  , Bdd.HighwPrice as HighwPrice ");
892
                sql.Append("  , Bdd.HardwPrice as HardwPrice ");
893
                sql.Append("  , Bdd.IndswasteTax as IndswasteTax ");
894
                sql.Append("  , DATE_FORMAT(Bdd.UpdateDate, '%Y/%m/%d %H:%i:%s') as UpdateDate ");
895
                sql.Append("  , ifnull(Bdd.Note, '') as Bikou ");
896
                sql.Append("  , ifnull(Pdd.BillPrice, 0) as KojiSeikyu ");
897
                sql.Append("  , ifnull(Pdd.DiscountPrice, 0) as KojiNebiki ");
898
                sql.Append("  , ifnull(Pdd.OffsetPrice, 0) as KojiSousai ");
899
                sql.Append("  , ifnull(Pdd.NextCoPrice, 0) as JikaiKurikosi ");
900
                sql.Append("  , ifnull(Pdd.HighwPrice, 0) as KojiKousoku ");
901
                sql.Append("  , ifnull(Pdd.HardwPrice, 0) as KojiKanamono ");
902
                sql.Append("  , ifnull(Pdd.IndswasteTax, 0) as KojiSannhaiZei ");
903
                sql.Append("  , ifnull(Pdd.CnstrPrice, 0) as CnstrPrice ");
904
                sql.Append("  , ifnull(Pdd.CnstrPriceExist, - 1) as CnstrPriceExist ");
905
                sql.Append("  , ifnull(Pdd.ApprovalPersonCode, 0) as ApprovalPersonCode ");
906
                sql.Append("  , ifnull(Picm.SealPrintName, '') as TantoNM ");
907
                sql.Append("  , DATE_FORMAT( ");
908
                sql.Append("    ifnull(Pdd.ApprovalDate, '2001/01/01') ");
909
                sql.Append("    , '%Y/%m/%d' ");
910
                sql.Append("  ) as ApprovalDate ");
911
                sql.Append("  , ifnull(Pdd.ApprovalEndFlg, 0) as ApprovalEndFlg ");
912
                sql.Append("  , ifnull(Cbi.SalesPersonCode, 0) as SalesPersonCode ");
913
                sql.Append("  , ifnull(Cbi.ConstructionPersonCode, 0) as ConstructionPersonCode ");
914
                sql.Append("  , ifnull(Cbi.ConstrSubPersonCode, 0) as ConstrSubPersonCode ");
915
                sql.Append("  , ifnull(Cbi.ConstructionInstructor, 0) as ConstructionInstructor ");
916
                sql.Append("  , Picm2.DepartmentCode ");
917
                sql.Append("  , case ifnull(Pod.SendDate, '') ");
918
                sql.Append("    when '' then '?~' ");
919
                sql.Append("    when '2001/01/01' then '?~' ");
920
                sql.Append("    else '??' ");
921
                sql.Append("    end as PurchaseOrderMailingDate ");
922
                sql.Append("  , case ifnull(Pod.ReturnCheckDate, '') ");
923
                sql.Append("    when '' then '?~' ");
924
                sql.Append("    when '2001/01/01' then '?~' ");
925
                sql.Append("    else '??' ");
926
                sql.Append("    end as PurchaseOrderReturnDate ");
927
                sql.Append("  , case ifnull(Pa.PersonCode, 0) ");
928
                sql.Append("    when 0 then case Bdd.ConstructionCode ");
929
                sql.Append("      when 0 then '' ");
930
                sql.Append("      else '?~' ");
931
                sql.Append("      end ");
932
                sql.Append("    else '??' ");
933
                sql.Append("    end as PaData ");
934
                sql.Append("  , null as LinePoint ");
935
                sql.Append("  , null as ColPoint ");
936
                sql.Append("from ");
937
                sql.Append("  BillingData as Bd join ( ");
938
                sql.Append("    BillingDataDetail as Bdd join SubContractorMaster as Scm ");
939
                sql.Append("      on Bdd.CompanyCode = Scm.CompanyCode ");
940
                sql.AppendFormat("      and Scm.LabourKind = {0} ", m_Labourkind);
941
                sql.Append("      left join ( ");
942
                sql.Append("        PaymentDataDetail as Pdd ");
943
                sql.Append("          left join PersonInChargeMaster as Picm ");
944
                sql.Append("            on ifnull(Pdd.ApprovalPersonCode, - 1) = Picm.PersonCode ");
945
                sql.Append("      ) ");
946
                sql.Append("        on Bdd.CompanyCode = Pdd.CompanyCode ");
947
                sql.Append("        and Bdd.TargetDate = Pdd.TargetDate ");
948
                sql.Append("        and Bdd.SeqNo = Pdd.SeqNo ");
949
                sql.Append("        and Bdd.LineCount = Pdd.LineCount ");
950
                sql.Append("      left join ( ");
951
                sql.Append("        ConstructionBaseInfo as Cbi ");
952
                sql.Append("          left join ( ");
953
                sql.Append("            PersonInChargeMaster as Picm2 ");
954
                sql.Append("              left join ApprovalMaster as Am ");
955
                sql.Append("                on Picm2.DepartmentCode = Am.DepartmentCode ");
956
                sql.Append("                and Am.ApprovalCode = 3 ");
957
                sql.Append("                and ApprovalAuthority = 1 ");
958
                sql.Append("          ) ");
959
                sql.Append("            on Cbi.ConstructionPersonCode = Picm2.PersonCode ");
960
                sql.Append("          left join ProcessApproval as Pa ");
961
                sql.Append("            on Cbi.ConstructionCode = Pa.ConstructionCode ");
962
                sql.Append("            and Am.ApprovalPerson = Pa.PersonCode ");
963
                sql.Append("            and Pa.SeqNo > 1 ");
964
                sql.Append("            and Pa.ApprovalStatus = 2 ");
965
                sql.Append("      ) ");
966
                sql.Append("        on Bdd.ConstructionCode = Cbi.ConstructionCode ");
967
                sql.Append("  ) ");
968
                sql.Append("       on Bd.CompanyCode = Bdd.CompanyCode ");
969
                sql.Append("       and Bd.TargetDate = Bdd.TargetDate ");
970
                sql.Append("       and Bd.SeqNo = Bdd.SeqNo ");
971
                sql.AppendFormat(" and Bd.TargetDate = {0} ", m_Select_TargetDate);
972
                sql.Append("    and Bdd.CONSTRUCTIONCODE = 0 ");
973
                sql.Append("  left join ( ");
974
                sql.Append("    PurchaseOrderDate as Pod ");
975
                sql.Append("  ) on Bd.CompanyCode = Pod.CompanyCode ");
976
                sql.Append("  and Bdd.ConstructionCode = Pod.ConstructionCode ");
1039
                    sql.Append("select ");
1040
                    sql.Append("  ifnull(Bd.SeqNo, 1) as SeqNo ");
1041
                    sql.Append("  , ifnull(Bdd.LineCount, 0) as LineCount ");
1042
                    sql.Append("  , ifnull(Bdd.CompanyCode, 0) as CompanyCode ");
1043
                    sql.Append("  , ifnull(Scm.CompanyName, \"\") as CompanyName ");
1044
                    sql.Append("  , Scm.DisplayOrder as DisplayOrder ");
1045
                    sql.Append("  , Bdd.ConstructionCode as ConstructionCode ");
1046
                    sql.Append("  , Bdd.FieldName as FieldName ");
1047
                    sql.Append("  , Bdd.BillPrice as BillPrice ");
1048
                    sql.Append("  , Bdd.HighwPrice as HighwPrice ");
1049
                    sql.Append("  , Bdd.HardwPrice as HardwPrice ");
1050
                    sql.Append("  , Bdd.IndswasteTax as IndswasteTax ");
1051
                    sql.Append("  , DATE_FORMAT(Bdd.UpdateDate, '%Y/%m/%d %H:%i:%s') as UpdateDate ");
1052
                    sql.Append("  , ifnull(Bdd.Note, '') as Bikou ");
1053
                    sql.Append("  , ifnull(Pdd.BillPrice, 0) as KojiSeikyu ");
1054
                    sql.Append("  , ifnull(Pdd.DiscountPrice, 0) as KojiNebiki ");
1055
                    sql.Append("  , ifnull(Pdd.OffsetPrice, 0) as KojiSousai ");
1056
                    sql.Append("  , ifnull(Pdd.NextCoPrice, 0) as JikaiKurikosi ");
1057
                    sql.Append("  , ifnull(Pdd.HighwPrice, 0) as KojiKousoku ");
1058
                    sql.Append("  , ifnull(Pdd.HardwPrice, 0) as KojiKanamono ");
1059
                    sql.Append("  , ifnull(Pdd.IndswasteTax, 0) as KojiSannhaiZei ");
1060
                    sql.Append("  , ifnull(Pdd.CnstrPrice, 0) as CnstrPrice ");
1061
                    sql.Append("  , ifnull(Pdd.CnstrPriceExist, - 1) as CnstrPriceExist ");
1062
                    sql.Append("  , ifnull(Pdd.ApprovalPersonCode, 0) as ApprovalPersonCode ");
1063
                    sql.Append("  , ifnull(Picm.SealPrintName, '') as TantoNM ");
1064
                    sql.Append("  , DATE_FORMAT( ");
1065
                    sql.Append("    ifnull(Pdd.ApprovalDate, '2001/01/01') ");
1066
                    sql.Append("    , '%Y/%m/%d' ");
1067
                    sql.Append("  ) as ApprovalDate ");
1068
                    sql.Append("  , ifnull(Pdd.ApprovalEndFlg, 0) as ApprovalEndFlg ");
1069
                    sql.Append("  , ifnull(Cbi.SalesPersonCode, 0) as SalesPersonCode ");
1070
                    sql.Append("  , ifnull(Cbi.ConstructionPersonCode, 0) as ConstructionPersonCode ");
1071
                    sql.Append("  , ifnull(Cbi.ConstrSubPersonCode, 0) as ConstrSubPersonCode ");
1072
                    sql.Append("  , ifnull(Cbi.ConstructionInstructor, 0) as ConstructionInstructor ");
1073
                    sql.Append("  , Picm2.DepartmentCode ");
1074
                    sql.Append("  , case ifnull(Pod.SendDate, '') ");
1075
                    sql.Append("    when '' then '?~' ");
1076
                    sql.Append("    when '2001/01/01' then '?~' ");
1077
                    sql.Append("    else '??' ");
1078
                    sql.Append("    end as PurchaseOrderMailingDate ");
1079
                    sql.Append("  , case ifnull(Pod.ReturnCheckDate, '') ");
1080
                    sql.Append("    when '' then '?~' ");
1081
                    sql.Append("    when '2001/01/01' then '?~' ");
1082
                    sql.Append("    else '??' ");
1083
                    sql.Append("    end as PurchaseOrderReturnDate ");
1084
                    sql.Append("  , case ifnull(Pa.PersonCode, 0) ");
1085
                    sql.Append("    when 0 then case Bdd.ConstructionCode ");
1086
                    sql.Append("      when 0 then '' ");
1087
                    sql.Append("      else '?~' ");
1088
                    sql.Append("      end ");
1089
                    sql.Append("    else '??' ");
1090
                    sql.Append("    end as PaData ");
1091
                    sql.Append("  , null as LinePoint ");
1092
                    sql.Append("  , null as ColPoint ");
1093
                    sql.Append("from ");
1094
                    sql.Append("  BillingData as Bd join ( ");
1095
                    sql.Append("    BillingDataDetail as Bdd join SubContractorMaster as Scm ");
1096
                    sql.Append("      on Bdd.CompanyCode = Scm.CompanyCode ");
1097
                    sql.AppendFormat("      and Scm.LabourKind = {0} ", m_Labourkind);
1098
                    sql.Append("      left join ( ");
1099
                    sql.Append("        PaymentDataDetail as Pdd ");
1100
                    sql.Append("          left join PersonInChargeMaster as Picm ");
1101
                    sql.Append("            on ifnull(Pdd.ApprovalPersonCode, - 1) = Picm.PersonCode ");
1102
                    sql.Append("      ) ");
1103
                    sql.Append("        on Bdd.CompanyCode = Pdd.CompanyCode ");
1104
                    sql.Append("        and Bdd.TargetDate = Pdd.TargetDate ");
1105
                    sql.Append("        and Bdd.SeqNo = Pdd.SeqNo ");
1106
                    sql.Append("        and Bdd.LineCount = Pdd.LineCount ");
1107
                    sql.Append("      left join ( ");
1108
                    sql.Append("        ConstructionBaseInfo as Cbi ");
1109
                    sql.Append("          left join ( ");
1110
                    sql.Append("            PersonInChargeMaster as Picm2 ");
1111
                    sql.Append("              left join ApprovalMaster as Am ");
1112
                    sql.Append("                on Picm2.DepartmentCode = Am.DepartmentCode ");
1113
                    sql.Append("                and Am.ApprovalCode = 3 ");
1114
                    sql.Append("                and ApprovalAuthority = 1 ");
1115
                    sql.Append("          ) ");
1116
                    sql.Append("            on Cbi.ConstructionPersonCode = Picm2.PersonCode ");
1117
                    sql.Append("          left join ProcessApproval as Pa ");
1118
                    sql.Append("            on Cbi.ConstructionCode = Pa.ConstructionCode ");
1119
                    sql.Append("            and Am.ApprovalPerson = Pa.PersonCode ");
1120
                    sql.Append("            and Pa.SeqNo > 1 ");
1121
                    sql.Append("            and Pa.ApprovalStatus = 2 ");
1122
                    sql.Append("      ) ");
1123
                    sql.Append("        on Bdd.ConstructionCode = Cbi.ConstructionCode ");
1124
                    sql.Append("  ) ");
1125
                    sql.Append("       on Bd.CompanyCode = Bdd.CompanyCode ");
1126
                    sql.Append("       and Bd.TargetDate = Bdd.TargetDate ");
1127
                    sql.Append("       and Bd.SeqNo = Bdd.SeqNo ");
1128
                    sql.AppendFormat(" and Bd.TargetDate = {0} ", m_Select_TargetDate);
1129
                    sql.Append("    and Bdd.CONSTRUCTIONCODE = 0 ");
1130
                    sql.Append("  left join ( ");
1131
                    sql.Append("    PurchaseOrderDate as Pod ");
1132
                    sql.Append("  ) on Bd.CompanyCode = Pod.CompanyCode ");
1133
                    sql.Append("  and Bdd.ConstructionCode = Pod.ConstructionCode ");
977 1134

  
978
                sql.Append(" ");
1135
                    sql.Append(" ");
979 1136
                
980
                sql.Append("group by ");
981
                sql.Append("  SeqNo ");
982
                sql.Append("  , LineCount ");
983
                sql.Append("  , CompanyCode ");
984
                sql.Append("  , CompanyName ");
985
                sql.Append("  , DisplayOrder ");
986
                sql.Append("  , ConstructionCode ");
987
                sql.Append("  , FieldName ");
988
                sql.Append("  , BillPrice ");
989
                sql.Append("  , HighwPrice ");
990
                sql.Append("  , Hardwprice ");
991
                sql.Append("  , IndswasteTax ");
992
                sql.Append("  , UpdateDate ");
993
                sql.Append("  , Bikou ");
994
                sql.Append("  , KojiSeikyu ");
995
                sql.Append("  , KojiNebiki ");
996
                sql.Append("  , KojiSousai ");
997
                sql.Append("  , JikaiKurikosi ");
998
                sql.Append("  , KojiKousoku ");
999
                sql.Append("  , KojiKanamono ");
1000
                sql.Append("  , KojiSannhaiZei ");
1001
                sql.Append("  , CnstrPrice ");
1002
                sql.Append("  , CnstrpriceExist ");
1003
                sql.Append("  , ApprovalPersonCode ");
1004
                sql.Append("  , TantoNM ");
1005
                sql.Append("  , ApprovalDate ");
1006
                sql.Append("  , ApprovalEndFlg ");
1007
                sql.Append("  , SalesPersonCode ");
1008
                sql.Append("  , ConstructionPersonCode ");
1009
                sql.Append("  , ConstrSubPersonCode ");
1010
                sql.Append("  , ConstructionInstructor ");
1011
                sql.Append("  , DepartmentCode ");
1012
                sql.Append("  , PurchaseOrderMailingDate ");
1013
                sql.Append("  , PurchaseOrderReturnDate ");
1014
                sql.Append("  , PaData ");
1015
                sql.Append("  , LinePoint ");
1016
                sql.Append("  , ColPoint ");
1137
                    sql.Append("group by ");
1138
                    sql.Append("  SeqNo ");
1139
                    sql.Append("  , LineCount ");
1140
                    sql.Append("  , CompanyCode ");
1141
                    sql.Append("  , CompanyName ");
1142
                    sql.Append("  , DisplayOrder ");
1143
                    sql.Append("  , ConstructionCode ");
1144
                    sql.Append("  , FieldName ");
1145
                    sql.Append("  , BillPrice ");
1146
                    sql.Append("  , HighwPrice ");
1147
                    sql.Append("  , Hardwprice ");
1148
                    sql.Append("  , IndswasteTax ");
1149
                    sql.Append("  , UpdateDate ");
1150
                    sql.Append("  , Bikou ");
1151
                    sql.Append("  , KojiSeikyu ");
1152
                    sql.Append("  , KojiNebiki ");
1153
                    sql.Append("  , KojiSousai ");
1154
                    sql.Append("  , JikaiKurikosi ");
1155
                    sql.Append("  , KojiKousoku ");
1156
                    sql.Append("  , KojiKanamono ");
1157
                    sql.Append("  , KojiSannhaiZei ");
1158
                    sql.Append("  , CnstrPrice ");
1159
                    sql.Append("  , CnstrpriceExist ");
1160
                    sql.Append("  , ApprovalPersonCode ");
1161
                    sql.Append("  , TantoNM ");
1162
                    sql.Append("  , ApprovalDate ");
1163
                    sql.Append("  , ApprovalEndFlg ");
1164
                    sql.Append("  , SalesPersonCode ");
1165
                    sql.Append("  , ConstructionPersonCode ");
1166
                    sql.Append("  , ConstrSubPersonCode ");
1167
                    sql.Append("  , ConstructionInstructor ");
1168
                    sql.Append("  , DepartmentCode ");
1169
                    sql.Append("  , PurchaseOrderMailingDate ");
1170
                    sql.Append("  , PurchaseOrderReturnDate ");
1171
                    sql.Append("  , PaData ");
1172
                    sql.Append("  , LinePoint ");
1173
                    sql.Append("  , ColPoint ");
1174
                }
1017 1175

  
1018 1176
                if (dgvCompany.Visible == true)         // ???P??\??
1019 1177
                {
......
1439 1597
            {
1440 1598
                sql.AppendLine("select Am.APPROVALPERSON,Picm.SealPrintName,Am.ApprovalAuthority ");
1441 1599
                sql.AppendLine("from ApprovalMaster as Am left join PersonInChargeMaster as Picm on Am.APPROVALPERSON = Picm.PERSONCODE ");
1442
                sql.AppendLine("where Am.APPROVALCODE = 99 ");
1600
                // ApprovalListNo ??R?[?h???????
1601
                //sql.AppendLine("where Am.APPROVALCODE = 99 "); // TODO
1602
                int iApprovalCode = ClsExcute.AppovalList.First(x => x.Value.Equals(s_MyProcessName[m_Labourkind])).Key;
1603
                sql.AppendFormat("where Am.APPROVALCODE = {0} ", iApprovalCode);
1443 1604
                sql.AppendFormat("and Am.DepartmentCode = {0} ", DepartmentCode);
1444 1605
                sql.AppendLine("order by Am.SEQNO desc ");
1445 1606

  
......
4375 4536
        /// <param name="e"></param>
4376 4537
        private void btnApproval_Click(object sender, EventArgs e)
4377 4538
        {
4378
            // ???F?{?^??????????
4379
            ApprovalProcess();
4539
            // ?I?????????o
4540
            DataGridView dgv = null;
4541
            DataGridViewCell SelectCell = null;
4542
            if (dgvCompany.Visible == true)         // ???P??\??
4543
            {
4544
                dgv = dgvCompany;
4545
            }
4546
            else if (dgvProject.Visible == true)    // ????P??\??
4547
            {
4548
                dgv = dgvProject;
4549
            }
4550
            foreach (DataGridViewCell c in dgv.SelectedCells)
4551
            {
4552
                SelectCell = c;
4553
            }
4554

  
4555
            if (SelectCell != null)
4556
            {
4557
                // ?x?????F???f?[?^???
4558
                PaymentApprovalInfo PaIWork = new PaymentApprovalInfo();
4559
                PaIWork.CompanyCode = CommonMotions.cnvInt(dgv.Rows[SelectCell.RowIndex].Cells[m_Company_Column].Value);
4560
                PaIWork.TargetDate = m_Select_TargetDate;
4561
                PaIWork.SeqNo = CommonMotions.cnvInt(dgv.Rows[SelectCell.RowIndex].Cells[(int)DispColumn.GroupSeqNo].Value);
4562
                PaIWork.LineCount = CommonMotions.cnvInt(dgv.Rows[SelectCell.RowIndex].Cells[(int)DispColumn.LineCount].Value);
4563

  
4564
                if ((PaIWork.CompanyCode == 0)
4565
                || (PaIWork.SeqNo == 0)
4566
                || (PaIWork.LineCount == 0)
4567
                    )
4568
                {
4569
                    MessageBox.Show("????????????????????F???s???????B", "???F?G???[", MessageBoxButtons.OK, MessageBoxIcon.Error); return;
4570
                }
4571
                if (MessageBox.Show("?I??????????s????F???s??????B", "???F?m?F", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) return;
4572
                // ???F?{?^??????????
4573
                ApprovalProcess(PaIWork);
4574
            }
4575
            else
4576
            {
4577
                MessageBox.Show("?s???I?????????????????F?\?????s???????B", "???F?\???G???[", MessageBoxButtons.OK, MessageBoxIcon.Error); return;
4578
            }
4380 4579
        }
4381 4580
        #endregion
4382 4581

  
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Request/RequestSummaryList/FrmRequestSummaryListAuxiliary.cs
1303 1303
        /// </summary>
1304 1304
        /// <param name="sender"></param>
1305 1305
        /// <param name="e"></param>
1306
        private void ApprovalProcess()
1306
        private void ApprovalProcess(PaymentApprovalInfo PaymentApprovalInfoData)
1307 1307
        {
1308 1308
            try
1309 1309
            {
......
1326 1326
                // ??t???
1327 1327
                ClsExcute.ProcControlPara[NowPoint].IntExecParameter.Add(CommonDefine.s_Default_OrderNo);
1328 1328

  
1329
                // ?x?????F???f?[?^
1330
                ArrayList PaymentApprovalInfoDataList = new ArrayList();
1331
                PaymentApprovalInfoDataList.Add(PaymentApprovalInfoData);
1332
                ClsExcute.ProcControlPara[NowPoint].ArrayParameter.Add(PaymentApprovalInfoDataList);
1333

  
1329 1334
                // ???t?H?[???I??
1330 1335
                this.Close();
1331 1336
            }

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