プロジェクト

全般

プロフィール

リビジョン 235

堀内7年以上前に追加

請求まとめ、可読性のため少し修正

差分を表示:

branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Request/RequestSummaryList/FrmRequestSummaryList.cs
716 716
        }
717 717
        #endregion
718 718

  
719
        #region ?O???b?h?\??
720
        /// <summary>
721
        /// ?O???b?h?\??
722
        /// </summary>
723
        /// <returns></returns>
724
        private bool DispGridData()
725
        {
726
            IOBillingData IoBd = new IOBillingData();
727
            ArrayList arData = new ArrayList();
728

  
729
            int DataGoukeiCd_Column = 0;
730
            int iShoninColumn = 0;
731

  
732
            StringBuilder sql;
733
            List<ShoninData> lstDefaultShonin = new List<ShoninData>();
734
            List<PaymentApprovalInfo> PaIList = new List<PaymentApprovalInfo>();
735
            PaymentApprovalInfo PaInfo = null;
736

  
737
            IOConstructionBaseInfo IoCbi = new IOConstructionBaseInfo();
738
            IOMPersonInCharge IoMpic = new IOMPersonInCharge();
739
            ConstructionBaseInfo Cbi = new ConstructionBaseInfo();
740
            PersonInChargeMaster Picm = new PersonInChargeMaster();
741
            string KojiTanto = "", KojiTantoCode = "";
742
            int ConstrDepartmentCode = 0;
743

  
744
            // ?N??????m?F // TODO
745
            if (ClsExcute.ProcControlPara.Count > 0)
746
            {
747
                for (int i = 0; i < ClsExcute.ProcControlPara.Count; i++)
748
                {
749
                    if ((ClsExcute.ProcControlPara[i].ArrayParameter != null) && (ClsExcute.ProcControlPara[i].ArrayParameter.Count > 0))
750
                    {
751
                        ArrayList obj = ClsExcute.ProcControlPara[i].ArrayParameter[0];
752
                        PaInfo = (PaymentApprovalInfo)obj[0];
753
                        if (PaInfo is PaymentApprovalInfo != true)
754
                        {
755
                            PaInfo = null;
756
                        }
757
                    }
758
                }
759
            }
760

  
761
            try
762
            {
763

  
764
                DataGridView dgv = getShowingView();
765

  
766
                // ???v?l?s?Z?o??P??
767
                if (m_viewTarget == 0)
768
                {
769
                    DataGoukeiCd_Column = (int)ClickGetData.COMPANYCODE;
770
                }
771
                else
772
                {
773
                    DataGoukeiCd_Column = (int)ClickGetData.CONSTRUCTIONCODE;
774
                }
775

  
776
                // ?????s??????
777
                DataGridView_ReadOnlyChange(dgv);
778

  
779

  
780
                // ?I?????????
781
                m_Select_TargetDate = CommonMotions.cnvInt(cmbTargetMonth.SelectedValue);
782

  
783
                // ??U?Z????l??X?C?x???g????????
784
                dgv.CellValueChanged -= DataGridView_CellValueChanged;
785

  
786
                // ?O???b?h??s??0????
787
                dgv.Rows.Clear();
788

  
789
                // SQL??
790
                sql = new StringBuilder();
791
                if (PaInfo != null)
792
                {
793
                    sql.Append("select ");
794
                    sql.Append("  ifnull(Bd.SeqNo, 1) as SeqNo ");
795
                    sql.Append("  , ifnull(Bdd.LineCount, 0) as LineCount ");
796
                    sql.Append("  , ifnull(Bdd.CompanyCode, 0) as CompanyCode ");
797
                    sql.Append("  , ifnull(Scm.CompanyName, \"\") as CompanyName ");
798
                    sql.Append("  , Scm.DisplayOrder as DisplayOrder ");
799
                    sql.Append("  , Bdd.ConstructionCode as ConstructionCode ");
800
                    sql.Append("  , Bdd.FieldName as FieldName ");
801
                    sql.Append("  , Bdd.BillPrice as BillPrice ");
802
                    sql.Append("  , Bdd.HighwPrice as HighwPrice ");
803
                    sql.Append("  , Bdd.HardwPrice as HardwPrice ");
804
                    sql.Append("  , Bdd.IndswasteTax as IndswasteTax ");
805
                    sql.Append("  , DATE_FORMAT(Bdd.UpdateDate, '%Y/%m/%d %H:%i:%s') as UpdateDate ");
806
                    sql.Append("  , ifnull(Bdd.Note, '') as Bikou ");
807
                    sql.Append("  , ifnull(Pdd.BillPrice, 0) as KojiSeikyu ");
808
                    sql.Append("  , ifnull(Pdd.DiscountPrice, 0) as KojiNebiki ");
809
                    sql.Append("  , ifnull(Pdd.OffsetPrice, 0) as KojiSousai ");
810
                    sql.Append("  , ifnull(Pdd.NextCoPrice, 0) as JikaiKurikosi ");
811
                    sql.Append("  , ifnull(Pdd.HighwPrice, 0) as KojiKousoku ");
812
                    sql.Append("  , ifnull(Pdd.HardwPrice, 0) as KojiKanamono ");
813
                    sql.Append("  , ifnull(Pdd.IndswasteTax, 0) as KojiSannhaiZei ");
814
                    sql.Append("  , ifnull(Pdd.CnstrPrice, 0) as CnstrPrice ");
815
                    sql.Append("  , ifnull(Pdd.CnstrPriceExist, - 1) as CnstrPriceExist ");
816
                    sql.Append("  , ifnull(Pdd.ApprovalPersonCode, 0) as ApprovalPersonCode ");
817
                    sql.Append("  , ifnull(Picm.SealPrintName, '') as TantoNM ");
818
                    sql.Append("  , DATE_FORMAT( ");
819
                    sql.Append("    ifnull(Pdd.ApprovalDate, '2001/01/01') ");
820
                    sql.Append("    , '%Y/%m/%d' ");
821
                    sql.Append("  ) as ApprovalDate ");
822
                    sql.Append("  , ifnull(Pdd.ApprovalEndFlg, 0) as ApprovalEndFlg ");
823
                    sql.Append("  , ifnull(Cbi.SalesPersonCode, 0) as SalesPersonCode ");
824
                    sql.Append("  , ifnull(Cbi.ConstructionPersonCode, 0) as ConstructionPersonCode ");
825
                    sql.Append("  , ifnull(Cbi.ConstrSubPersonCode, 0) as ConstrSubPersonCode ");
826
                    sql.Append("  , ifnull(Cbi.ConstructionInstructor, 0) as ConstructionInstructor ");
827
                    sql.Append("  , Picm2.DepartmentCode ");
828
                    sql.Append("  , case ifnull(Pod.SendDate, '') ");
829
                    sql.Append("    when '' then '?~' ");
830
                    sql.Append("    when '2001/01/01' then '?~' ");
831
                    sql.Append("    else '??' ");
832
                    sql.Append("    end as PurchaseOrderMailingDate ");
833
                    sql.Append("  , case ifnull(Pod.ReturnCheckDate, '') ");
834
                    sql.Append("    when '' then '?~' ");
835
                    sql.Append("    when '2001/01/01' then '?~' ");
836
                    sql.Append("    else '??' ");
837
                    sql.Append("    end as PurchaseOrderReturnDate ");
838
                    sql.Append("  , case ifnull(Pa.PersonCode, 0) ");
839
                    sql.Append("    when 0 then case Bdd.ConstructionCode ");
840
                    sql.Append("      when 0 then '' ");
841
                    sql.Append("      else '?~' ");
842
                    sql.Append("      end ");
843
                    sql.Append("    else '??' ");
844
                    sql.Append("    end as PaData ");
845
                    sql.Append("  , null as LinePoint ");
846
                    sql.Append("  , null as ColPoint ");
847
                    sql.Append("from ");
848
                    sql.Append("  BillingData as Bd join ( ");
849
                    sql.Append("    BillingDataDetail as Bdd join SubContractorMaster as Scm ");
850
                    sql.Append("      on Bdd.CompanyCode = Scm.CompanyCode ");
851
                    sql.AppendFormat("      and Scm.LabourKind = {0} ", m_Labourkind);
852
                    sql.Append("      left join ( ");
853
                    sql.Append("        PaymentDataDetail as Pdd ");
854
                    sql.Append("          left join PersonInChargeMaster as Picm ");
855
                    sql.Append("            on ifnull(Pdd.ApprovalPersonCode, - 1) = Picm.PersonCode ");
856
                    sql.Append("      ) ");
857
                    sql.Append("        on Bdd.CompanyCode = Pdd.CompanyCode ");
858
                    sql.Append("        and Bdd.TargetDate = Pdd.TargetDate ");
859
                    sql.Append("        and Bdd.SeqNo = Pdd.SeqNo ");
860
                    sql.Append("        and Bdd.LineCount = Pdd.LineCount ");
861
                    sql.Append("      left join ( ");
862
                    sql.Append("        ConstructionBaseInfo as Cbi ");
863
                    sql.Append("          left join ( ");
864
                    sql.Append("            PersonInChargeMaster as Picm2 ");
865
                    sql.Append("              left join ApprovalMaster as Am ");
866
                    sql.Append("                on Picm2.DepartmentCode = Am.DepartmentCode ");
867
                    sql.Append("                and Am.ApprovalCode = 3 ");
868
                    sql.Append("                and ApprovalAuthority = 1 ");
869
                    sql.Append("          ) ");
870
                    sql.Append("            on Cbi.ConstructionPersonCode = Picm2.PersonCode ");
871
                    sql.Append("          left join ProcessApproval as Pa ");
872
                    sql.Append("            on Cbi.ConstructionCode = Pa.ConstructionCode ");
873
                    sql.Append("            and Am.ApprovalPerson = Pa.PersonCode ");
874
                    sql.Append("            and Pa.SeqNo > 1 ");
875
                    sql.Append("            and Pa.ApprovalStatus = 2 ");
876
                    sql.Append("      ) ");
877
                    sql.Append("        on Bdd.ConstructionCode = Cbi.ConstructionCode ");
878
                    sql.Append("  ) ");
879
                    sql.Append("       on Bd.CompanyCode = Bdd.CompanyCode ");
880
                    sql.Append("       and Bd.TargetDate = Bdd.TargetDate ");
881
                    sql.Append("       and Bd.SeqNo = Bdd.SeqNo ");
882
                    sql.AppendFormat(" and Bd.TargetDate = {0} ", PaInfo.TargetDate);
883
                    sql.Append("  left join ( ");
884
                    sql.Append("    PurchaseOrderDate as Pod ");
885
                    sql.Append("  ) on Bd.CompanyCode = Pod.CompanyCode ");
886
                    sql.Append("  and Bdd.ConstructionCode = Pod.ConstructionCode ");
887

  
888
                    sql.Append(" ");
889

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

  
1044
                    sql.Append(" ");
1045
                    sql.Append("union ");
1046
                    sql.Append(" ");
1047

  
1048
                    sql.Append("select ");
1049
                    sql.Append("  ifnull(Bd.SeqNo, 1) as SeqNo ");
1050
                    sql.Append("  , ifnull(Bdd.LineCount, 0) as LineCount ");
1051
                    sql.Append("  , ifnull(Bdd.CompanyCode, 0) as CompanyCode ");
1052
                    sql.Append("  , ifnull(Scm.CompanyName, \"\") as CompanyName ");
1053
                    sql.Append("  , Scm.DisplayOrder as DisplayOrder ");
1054
                    sql.Append("  , Bdd.ConstructionCode as ConstructionCode ");
1055
                    sql.Append("  , Bdd.FieldName as FieldName ");
1056
                    sql.Append("  , Bdd.BillPrice as BillPrice ");
1057
                    sql.Append("  , Bdd.HighwPrice as HighwPrice ");
1058
                    sql.Append("  , Bdd.HardwPrice as HardwPrice ");
1059
                    sql.Append("  , Bdd.IndswasteTax as IndswasteTax ");
1060
                    sql.Append("  , DATE_FORMAT(Bdd.UpdateDate, '%Y/%m/%d %H:%i:%s') as UpdateDate ");
1061
                    sql.Append("  , ifnull(Bdd.Note, '') as Bikou ");
1062
                    sql.Append("  , ifnull(Pdd.BillPrice, 0) as KojiSeikyu ");
1063
                    sql.Append("  , ifnull(Pdd.DiscountPrice, 0) as KojiNebiki ");
1064
                    sql.Append("  , ifnull(Pdd.OffsetPrice, 0) as KojiSousai ");
1065
                    sql.Append("  , ifnull(Pdd.NextCoPrice, 0) as JikaiKurikosi ");
1066
                    sql.Append("  , ifnull(Pdd.HighwPrice, 0) as KojiKousoku ");
1067
                    sql.Append("  , ifnull(Pdd.HardwPrice, 0) as KojiKanamono ");
1068
                    sql.Append("  , ifnull(Pdd.IndswasteTax, 0) as KojiSannhaiZei ");
1069
                    sql.Append("  , ifnull(Pdd.CnstrPrice, 0) as CnstrPrice ");
1070
                    sql.Append("  , ifnull(Pdd.CnstrPriceExist, - 1) as CnstrPriceExist ");
1071
                    sql.Append("  , ifnull(Pdd.ApprovalPersonCode, 0) as ApprovalPersonCode ");
1072
                    sql.Append("  , ifnull(Picm.SealPrintName, '') as TantoNM ");
1073
                    sql.Append("  , DATE_FORMAT( ");
1074
                    sql.Append("    ifnull(Pdd.ApprovalDate, '2001/01/01') ");
1075
                    sql.Append("    , '%Y/%m/%d' ");
1076
                    sql.Append("  ) as ApprovalDate ");
1077
                    sql.Append("  , ifnull(Pdd.ApprovalEndFlg, 0) as ApprovalEndFlg ");
1078
                    sql.Append("  , ifnull(Cbi.SalesPersonCode, 0) as SalesPersonCode ");
1079
                    sql.Append("  , ifnull(Cbi.ConstructionPersonCode, 0) as ConstructionPersonCode ");
1080
                    sql.Append("  , ifnull(Cbi.ConstrSubPersonCode, 0) as ConstrSubPersonCode ");
1081
                    sql.Append("  , ifnull(Cbi.ConstructionInstructor, 0) as ConstructionInstructor ");
1082
                    sql.Append("  , Picm2.DepartmentCode ");
1083
                    sql.Append("  , case ifnull(Pod.SendDate, '') ");
1084
                    sql.Append("    when '' then '?~' ");
1085
                    sql.Append("    when '2001/01/01' then '?~' ");
1086
                    sql.Append("    else '??' ");
1087
                    sql.Append("    end as PurchaseOrderMailingDate ");
1088
                    sql.Append("  , case ifnull(Pod.ReturnCheckDate, '') ");
1089
                    sql.Append("    when '' then '?~' ");
1090
                    sql.Append("    when '2001/01/01' then '?~' ");
1091
                    sql.Append("    else '??' ");
1092
                    sql.Append("    end as PurchaseOrderReturnDate ");
1093
                    sql.Append("  , case ifnull(Pa.PersonCode, 0) ");
1094
                    sql.Append("    when 0 then case Bdd.ConstructionCode ");
1095
                    sql.Append("      when 0 then '' ");
1096
                    sql.Append("      else '?~' ");
1097
                    sql.Append("      end ");
1098
                    sql.Append("    else '??' ");
1099
                    sql.Append("    end as PaData ");
1100
                    sql.Append("  , null as LinePoint ");
1101
                    sql.Append("  , null as ColPoint ");
1102
                    sql.Append("from ");
1103
                    sql.Append("  BillingData as Bd join ( ");
1104
                    sql.Append("    BillingDataDetail as Bdd join SubContractorMaster as Scm ");
1105
                    sql.Append("      on Bdd.CompanyCode = Scm.CompanyCode ");
1106
                    sql.AppendFormat("      and Scm.LabourKind = {0} ", m_Labourkind);
1107
                    sql.Append("      left join ( ");
1108
                    sql.Append("        PaymentDataDetail as Pdd ");
1109
                    sql.Append("          left join PersonInChargeMaster as Picm ");
1110
                    sql.Append("            on ifnull(Pdd.ApprovalPersonCode, - 1) = Picm.PersonCode ");
1111
                    sql.Append("      ) ");
1112
                    sql.Append("        on Bdd.CompanyCode = Pdd.CompanyCode ");
1113
                    sql.Append("        and Bdd.TargetDate = Pdd.TargetDate ");
1114
                    sql.Append("        and Bdd.SeqNo = Pdd.SeqNo ");
1115
                    sql.Append("        and Bdd.LineCount = Pdd.LineCount ");
1116
                    sql.Append("      left join ( ");
1117
                    sql.Append("        ConstructionBaseInfo as Cbi ");
1118
                    sql.Append("          left join ( ");
1119
                    sql.Append("            PersonInChargeMaster as Picm2 ");
1120
                    sql.Append("              left join ApprovalMaster as Am ");
1121
                    sql.Append("                on Picm2.DepartmentCode = Am.DepartmentCode ");
1122
                    sql.Append("                and Am.ApprovalCode = 3 ");
1123
                    sql.Append("                and ApprovalAuthority = 1 ");
1124
                    sql.Append("          ) ");
1125
                    sql.Append("            on Cbi.ConstructionPersonCode = Picm2.PersonCode ");
1126
                    sql.Append("          left join ProcessApproval as Pa ");
1127
                    sql.Append("            on Cbi.ConstructionCode = Pa.ConstructionCode ");
1128
                    sql.Append("            and Am.ApprovalPerson = Pa.PersonCode ");
1129
                    sql.Append("            and Pa.SeqNo > 1 ");
1130
                    sql.Append("            and Pa.ApprovalStatus = 2 ");
1131
                    sql.Append("      ) ");
1132
                    sql.Append("        on Bdd.ConstructionCode = Cbi.ConstructionCode ");
1133
                    sql.Append("  ) ");
1134
                    sql.Append("       on Bd.CompanyCode = Bdd.CompanyCode ");
1135
                    sql.Append("       and Bd.TargetDate = Bdd.TargetDate ");
1136
                    sql.Append("       and Bd.SeqNo = Bdd.SeqNo ");
1137
                    sql.AppendFormat(" and Bd.TargetDate = {0} ", m_Select_TargetDate);
1138
                    sql.Append("    and Bdd.CONSTRUCTIONCODE = 0 ");
1139
                    sql.Append("  left join ( ");
1140
                    sql.Append("    PurchaseOrderDate as Pod ");
1141
                    sql.Append("  ) on Bd.CompanyCode = Pod.CompanyCode ");
1142
                    sql.Append("  and Bdd.ConstructionCode = Pod.ConstructionCode ");
1143

  
1144
                    sql.Append(" ");
1145
                
1146
                    sql.Append("group by ");
1147
                    sql.Append("  SeqNo ");
1148
                    sql.Append("  , LineCount ");
1149
                    sql.Append("  , CompanyCode ");
1150
                    sql.Append("  , CompanyName ");
1151
                    sql.Append("  , DisplayOrder ");
1152
                    sql.Append("  , ConstructionCode ");
1153
                    sql.Append("  , FieldName ");
1154
                    sql.Append("  , BillPrice ");
1155
                    sql.Append("  , HighwPrice ");
1156
                    sql.Append("  , Hardwprice ");
1157
                    sql.Append("  , IndswasteTax ");
1158
                    sql.Append("  , UpdateDate ");
1159
                    sql.Append("  , Bikou ");
1160
                    sql.Append("  , KojiSeikyu ");
1161
                    sql.Append("  , KojiNebiki ");
1162
                    sql.Append("  , KojiSousai ");
1163
                    sql.Append("  , JikaiKurikosi ");
1164
                    sql.Append("  , KojiKousoku ");
1165
                    sql.Append("  , KojiKanamono ");
1166
                    sql.Append("  , KojiSannhaiZei ");
1167
                    sql.Append("  , CnstrPrice ");
1168
                    sql.Append("  , CnstrpriceExist ");
1169
                    sql.Append("  , ApprovalPersonCode ");
1170
                    sql.Append("  , TantoNM ");
1171
                    sql.Append("  , ApprovalDate ");
1172
                    sql.Append("  , ApprovalEndFlg ");
1173
                    sql.Append("  , SalesPersonCode ");
1174
                    sql.Append("  , ConstructionPersonCode ");
1175
                    sql.Append("  , ConstrSubPersonCode ");
1176
                    sql.Append("  , ConstructionInstructor ");
1177
                    sql.Append("  , DepartmentCode ");
1178
                    sql.Append("  , PurchaseOrderMailingDate ");
1179
                    sql.Append("  , PurchaseOrderReturnDate ");
1180
                    sql.Append("  , PaData ");
1181
                    sql.Append("  , LinePoint ");
1182
                    sql.Append("  , ColPoint ");
1183
                }
1184

  
1185
                if (dgvCompany.Visible == true)         // ???P??\??
1186
                {
1187
                    sql.AppendLine("order by CompanyCode ASC, SeqNo DESC, case when ConstructionCode = 0 Then  2099999999 else LineCount end ");
1188
                }
1189
                else if (dgvProject.Visible == true)    // ????P??\??
1190
                {
1191
                    sql.AppendLine("order by ConstructionPersonCode ASC, ConstructionCode DESC, DisplayOrder ASC, SEQNO ASC, LineCount ASC ");
1192
                }
1193

  
1194
                // ?f?[?^???@???v?E???v???v?Z?????A?S???f?[?^????????
1195
                if (!IoBd.ExecuteReader(sql.ToString(), ref arData)) return false;
1196

  
1197
                // ?f?[?^?\??
1198
                int icnt = 0;
1199
                int iNo = 1;
1200
                int iGoukeiSeq = 0;
1201
                int iGoukeiCd = -1;
1202
                int iDataCount = 0;
1203
                int iShoninMaxCount = 0;
1204
                foreach (object[] work in arData)
1205
                {
1206
                    // ???v?s??
1207
                    if (iGoukeiCd != CommonMotions.cnvInt(work[DataGoukeiCd_Column]))
1208
                    {
1209
                        if (iGoukeiCd != -1)
1210
                        {
1211
                            // ????\??????????f?[?^?????`?F?b?N
1212
                            iDataCount = dgv.Rows.Cast<DataGridViewRow>().Where(x => CommonMotions.cnvInt(x.Cells[(int)DispColumn.RowType].Value) == 0
1213
                                                                                  && CommonMotions.cnvInt(x.Cells[(int)DispColumn.RowVisible].Value) == 1
1214
                                                                                  && CommonMotions.cnvInt(x.Cells[m_GoukeiCode_Column].Value) == iGoukeiCd)
1215
                                                                         .Count();
1216

  
1217
                            if (iDataCount > 0)
1218
                            {
1219
                                // ???v?s???
1220
                                MakeGoukeiGyo(dgv, iGoukeiCd);
1221
                                icnt += System.Enum.GetValues(typeof(GoukeiRows)).Length;
1222

  
1223
                                // ???v?l???
1224
                                setGoukei_DataDisp(dgv, iGoukeiCd);
1225

  
1226
                            }
1227
                            iNo++;
1228
                        }
1229
                        iGoukeiSeq = 1;
1230
                        iGoukeiCd = CommonMotions.cnvInt(work[DataGoukeiCd_Column]);
1231
                    }
1232

  
1233

  
1234
                    dgv.Rows.Add();
1235

  
1236
                    dgv.Rows[icnt].Cells[(int)DispColumn.CompanyDispOrder].Value = CommonMotions.cnvInt(work[(int)ClickGetData.DisplayOrder]);
1237
                    dgv.Rows[icnt].Cells[(int)DispColumn.ApprovalEndFlg].Value = CommonMotions.cnvInt(work[(int)ClickGetData.ApprovalEndFlg]);
1238
                    dgv.Rows[icnt].Cells[(int)DispColumn.UpdateDate].Value = CommonMotions.cnvString(work[(int)ClickGetData.UpdateDate]);
1239

  
1240
                    dgv.Rows[icnt].Cells[(int)DispColumn.RowState].Value = DataRowState.Modified;
1241
                    dgv.Rows[icnt].Cells[(int)DispColumn.RowType].Value = 0;
1242
                    dgv.Rows[icnt].Cells[(int)DispColumn.GoukeiSeqNo].Value = iGoukeiSeq;
1243
                    dgv.Rows[icnt].Cells[(int)DispColumn.GroupSeqNo].Value = CommonMotions.cnvInt(work[(int)ClickGetData.SEQNO]);
1244
                    dgv.Rows[icnt].Cells[(int)DispColumn.LineCount].Value = CommonMotions.cnvInt(work[(int)ClickGetData.LINECOUNT]);
1245
                    dgv.Rows[icnt].Cells[(int)DispColumn.No].Value = iNo;
1246

  
1247
                    dgv.Rows[icnt].Cells[m_Company_Column].Value = CommonMotions.cnvInt(work[(int)ClickGetData.COMPANYCODE]);
1248
                    dgv.Rows[icnt].Cells[m_CompanyNM_Column].Value = CommonMotions.cnvString(work[(int)ClickGetData.COMPANYNAME]);
1249
                    dgv.Rows[icnt].Cells[m_CompanyNM_Column].ToolTipText = CommonMotions.cnvString(work[(int)ClickGetData.COMPANYNAME]);
1250
                    dgv.Rows[icnt].Cells[m_Genba_Column].Value = CommonMotions.cnvInt(work[(int)ClickGetData.CONSTRUCTIONCODE]);
1251
                    dgv.Rows[icnt].Cells[m_GenbaNM_Column].Value = CommonMotions.cnvString(work[(int)ClickGetData.FIELDNAME]);
1252
                    dgv.Rows[icnt].Cells[m_GenbaNM_Column].ToolTipText = CommonMotions.cnvString(work[(int)ClickGetData.FIELDNAME]);
1253

  
1254
                    dgv.Rows[icnt].Cells[(int)DispColumn.SomuSeikyu].Value = CommonMotions.cnvInt(work[(int)ClickGetData.BILLPRICE]);
1255
                    dgv.Rows[icnt].Cells[(int)DispColumn.SomuKosoku].Value = CommonMotions.cnvInt(work[(int)ClickGetData.HIGHWPRICE]);
1256
                    dgv.Rows[icnt].Cells[(int)DispColumn.SomuKanamono].Value = CommonMotions.cnvInt(work[(int)ClickGetData.HARDWPRICE]);
1257
                    dgv.Rows[icnt].Cells[(int)DispColumn.SomuSannhaiZei].Value = CommonMotions.cnvInt(work[(int)ClickGetData.INDSWASTETAX]);
1258

  
1259
                    dgv.Rows[icnt].Cells[(int)DispColumn.KojiSeikyu].Value = CommonMotions.cnvInt(work[(int)ClickGetData.KojiSeikyu]);
1260

  
1261
                    dgv.Rows[icnt].Cells[(int)DispColumn.KojiNebiki].Value = CommonMotions.cnvInt(work[(int)ClickGetData.KojiNebiki]);
1262
                    dgv.Rows[icnt].Cells[(int)DispColumn.KojiSousai].Value = CommonMotions.cnvInt(work[(int)ClickGetData.KojiSousai]);
1263
                    dgv.Rows[icnt].Cells[(int)DispColumn.JikaiKurikosi].Value = CommonMotions.cnvInt(work[(int)ClickGetData.JikaiKurikosi]);
1264

  
1265
                    dgv.Rows[icnt].Cells[(int)DispColumn.KojiKosoku].Value = CommonMotions.cnvInt(work[(int)ClickGetData.KojiKosoku]);
1266
                    dgv.Rows[icnt].Cells[(int)DispColumn.KojiKanamono].Value = CommonMotions.cnvInt(work[(int)ClickGetData.KojiKanamono]);
1267
                    dgv.Rows[icnt].Cells[(int)DispColumn.KojiSannhaiZei].Value = CommonMotions.cnvInt(work[(int)ClickGetData.KojiSannhaiZei]);
1268

  
1269
                    dgv.Rows[icnt].Cells[(int)DispColumn.KyoryokuKin].Value = CommonMotions.cnvInt(work[(int)ClickGetData.CnstrPrice]);
1270
                    dgv.Rows[icnt].Cells[(int)DispColumn.KyoryokuUmu].Value = CommonMotions.cnvInt(work[(int)ClickGetData.CNSTRPRICEEXIST]);
1271

  
1272
                    dgv.Rows[icnt].Cells[(int)DispColumn.CyuumonshoTeisyutu].Value = CommonMotions.cnvString(work[(int)ClickGetData.PurchaseOrderMailingDate]);
1273
                    dgv.Rows[icnt].Cells[(int)DispColumn.CyuumonshoTouchaku].Value = CommonMotions.cnvString(work[(int)ClickGetData.PurchaseOrderReturnDate]);
1274
                    dgv.Rows[icnt].Cells[(int)DispColumn.YosanSho].Value = CommonMotions.cnvString(work[(int)ClickGetData.PaData]);
1275

  
1276
                    // ?S??????F
1277
                    bool ApprovalPerson = CommonMotions.cnvInt(work[(int)ClickGetData.ApprovalPersonCode]) != 0 ? true : false;
1278
                    bool SekininApproval = false;
1279
                    if (ApprovalPerson == true)
1280
                    {
1281
                        dgv.Rows[icnt].Cells[(int)DispColumn.TantoShoninCode].Value = CommonMotions.cnvInt(work[(int)ClickGetData.ApprovalPersonCode]);
1282
                        dgv.Rows[icnt].Cells[(int)DispColumn.TantoShonin].Value = CommonMotions.cnvString(work[(int)ClickGetData.TantoNM]);
1283
                        dgv.Rows[icnt].Cells[(int)DispColumn.TantoDate].Value = CommonMotions.cnvString(work[(int)ClickGetData.ApprovalDate]);
1284

  
1285
                        // ?S?????F??f?[?^
1286
                        iShoninColumn = (int)DispColumn.Shonin1Code;
1287
                        if (!GetShonin(CommonMotions.cnvInt(work[(int)ClickGetData.COMPANYCODE]), CommonMotions.cnvInt(work[(int)ClickGetData.SEQNO]), CommonMotions.cnvInt(work[(int)ClickGetData.LINECOUNT]), ref PaIList)) return false;
1288
                        iShoninMaxCount = iShoninMaxCount < PaIList.Count ? PaIList.Count : iShoninMaxCount;
1289
                        foreach (PaymentApprovalInfo pair in PaIList)
1290
                        {
1291
                            dgv.Rows[icnt].Cells[iShoninColumn++].Value = pair.ApprovalPerson;
1292
                            if (pair.ApprovalDate == new DateTime(2001, 01, 01))
1293
                            {
1294
                                dgv.Rows[icnt].Cells[iShoninColumn].Style.ForeColor = Color.Gray;
1295
                            }
1296
                            else
1297
                            {
1298
                                // ???F??????F????????A????????
1299
                                if (SekininApproval == false && (m_UserInfo.m_Type == CommonDefine.SecurityRankPos.LimitedAuthority || m_UserInfo.m_Type == CommonDefine.SecurityRankPos.FreeAuthority))
1300
                                {
1301
                                    if (CommonMotions.LoginUserData.PersonCode == pair.ApprovalPerson)
1302
                                    {
1303
                                        SekininApproval = true;
1304
                                    }
1305
                                }
1306
                            }
1307
                            dgv.Rows[icnt].Cells[iShoninColumn++].Value = pair.ApprovalPersonName;
1308
                            dgv.Rows[icnt].Cells[iShoninColumn++].Value = pair.ApprovalDate;
1309
                            dgv.Rows[icnt].Cells[iShoninColumn++].Value = pair.ApprovalAuthority;
1310
                            dgv.Rows[icnt].Cells[iShoninColumn++].Value = pair.ApprovalNo;
1311
                        }
1312

  
1313
                    }
1314
                    else
1315
                    {
1316
                        //???????????????????F
1317
                        if (CommonMotions.cnvInt(dgv.Rows[icnt].Cells[m_Genba_Column].Value) != 0)
1318
                        {
1319
                            // ?I???????H????H???S??????????????????
1320

  
1321
                            string sWhere = IoCbi.CreatePrimarykeyString(CommonMotions.cnvInt(dgv.Rows[icnt].Cells[m_Genba_Column].Value));
1322
                            if (!IoCbi.SelectAction(sWhere, ref Cbi)) throw new Exception("?H????{?????G???[");
1323

  
1324
                            sWhere = IoMpic.CreatePrimarykeyString(Cbi.ConstructionPersonCode);
1325
                            if (!IoMpic.SelectAction(sWhere, ref Picm)) throw new Exception("?S????}?X?^???G???[");
1326
                            ConstrDepartmentCode = Picm.DepartmentCode;
1327

  
1328
                            //?H???S????
1329
                            KojiTantoCode = Picm.PersonCode.ToString();
1330
                            KojiTanto = Picm.SealPrintName;
1331

  
1332
                            //?S??????F???
1333
                            dgv.Rows[icnt].Cells[(int)DispColumn.TantoShoninCode].Value = KojiTantoCode;
1334
                            dgv.Rows[icnt].Cells[(int)DispColumn.TantoShonin].Value = KojiTanto;
1335
                            dgv.Rows[icnt].Cells[(int)DispColumn.TantoShonin].Style.ForeColor = Color.Gray;
1336

  
1337
                            // ?S????????F?f?[?^
1338
                            int iDefaultDataCount = 0;
1339
                                if (!SetDefaultShonin(dgv, icnt, ConstrDepartmentCode, ref iDefaultDataCount)) return false;
1340
                            iShoninMaxCount = iShoninMaxCount < iDefaultDataCount ? iDefaultDataCount : iShoninMaxCount;
1341
                        }
1342
                        else
1343
                        {
1344
                            dgv.Rows[icnt].Cells[(int)DispColumn.TantoShoninCode].Value = "";
1345
                            dgv.Rows[icnt].Cells[(int)DispColumn.TantoShonin].Value = ""; 
1346
                            dgv.Rows[icnt].Cells[(int)DispColumn.TantoShonin].Style.ForeColor = Color.Gray;
1347
                        }
1348

  
1349
                    }
1350

  
1351
                    // ???l???
1352
                    dgv.Rows[icnt].Cells[(int)DispColumn.Bikou].Value = CommonMotions.cnvString(work[(int)ClickGetData.Bikou]);
1353
                    // ?H????????s????A????????
1354
                    dgv.Rows[icnt].Cells[(int)DispColumn.ConstructionLedgerLineNo].Value = CommonMotions.cnvString(work[(int)ClickGetData.ConstructionLedgerLineNo]);
1355
                    dgv.Rows[icnt].Cells[(int)DispColumn.ConstructionLedgerRowNo].Value = CommonMotions.cnvString(work[(int)ClickGetData.ConstructionLedgerRowNo]);
1356

  
1357
                    // ??????????\????\??
1358
                    // ?????l????
1359
                    dgv.Rows[icnt].Visible = true;
1360
                    dgv.Rows[icnt].Cells[(int)DispColumn.RowVisible].Value = 1;
1361

  
1362
                    // ?s????O
1363
                    if (CommonMotions.cnvInt(work[(int)ClickGetData.CONSTRUCTIONCODE]) != 0)
1364
                    {
1365
                        // ?s????O???U?s????????
1366
                        dgv.Rows[icnt].Visible = false;
1367
                        dgv.Rows[icnt].Cells[(int)DispColumn.RowVisible].Value = 0;
1368

  
1369
                        // ?????S??
1370
                        if (m_UserInfo.m_GeneralAffairsFlg == 1)
1371
                        {
1372
                            // ?????????W????S??????Q?????\????A??W??\???????????????????????B
1373
                            dgv.Rows[icnt].Visible = true;
1374
                            dgv.Rows[icnt].Cells[(int)DispColumn.RowVisible].Value = 1;
1375
                        }
1376
                        // ??????????
1377
                        else if (m_UserInfo.m_Type == CommonDefine.SecurityRankPos.SpecialAuthority)
1378
                        {
1379
                            // ?????????W????S??????Q?????\????A??????????????O???W??\?????B
1380
                            dgv.Rows[icnt].Visible = true;
1381
                            dgv.Rows[icnt].Cells[(int)DispColumn.RowVisible].Value = 1;
1382
                        }
1383
                        // ???????A????????
1384
                        else if (m_UserInfo.m_Type == CommonDefine.SecurityRankPos.LimitedAuthority || m_UserInfo.m_Type == CommonDefine.SecurityRankPos.FreeAuthority)
1385
                        {
1386
                            // ?Q????????????`?F?b?N
1387
                            foreach (PersonDepartmentMaster RefDepRec in CommonMotions.LoginUserDepartment)
1388
                            {
1389
                                // ??????????????????????H?????\??????
1390
                                if (RefDepRec.DepartmentCode != CommonMotions.cnvInt(work[(int)ClickGetData.DepartmentCode]))
1391
                                {
1392
                                    dgv.Rows[icnt].Visible = true;
1393
                                    dgv.Rows[icnt].Cells[(int)DispColumn.RowVisible].Value = 1;
1394
                                }
1395
                            }
1396
                        }
1397
                        // ?S??????
1398
                        else if (m_UserInfo.m_Type == CommonDefine.SecurityRankPos.NormalAuthority)
1399
                        {
1400
                            if (m_UserInfo.m_SecRange == ClsSecurityPermission.SecRangeType.InCharge)
1401
                            {
1402
                                // ?c??S??
1403
                                if (CommonMotions.LoginUserData.PersonCode == CommonMotions.cnvInt(work[(int)ClickGetData.SalesPersonCode]))
1404
                                {
1405
                                    dgv.Rows[icnt].Visible = true;
1406
                                    dgv.Rows[icnt].Cells[(int)DispColumn.RowVisible].Value = 1;
1407
                                }
1408
                                // ?H???S??
1409
                                if (CommonMotions.LoginUserData.PersonCode == CommonMotions.cnvInt(work[(int)ClickGetData.ConstructionPersonCode])
1410
                                    || CommonMotions.LoginUserData.PersonCode == CommonMotions.cnvInt(work[(int)ClickGetData.ConstrSubPersonCode])
1411
                                    || CommonMotions.LoginUserData.PersonCode == CommonMotions.cnvInt(work[(int)ClickGetData.ConstructionInstructor]))
1412
                                {
1413
                                    dgv.Rows[icnt].Visible = true;
1414
                                    dgv.Rows[icnt].Cells[(int)DispColumn.RowVisible].Value = 1;
1415
                                }
1416
                            }
1417
                            else if (m_UserInfo.m_SecRange == ClsSecurityPermission.SecRangeType.OneDepartment)
1418
                            {
1419
                                // ?Q????????????`?F?b?N
1420
                                foreach (PersonDepartmentMaster RefDepRec in CommonMotions.LoginUserDepartment)
1421
                                {
1422
                                    // ??????????????????????H?????\??????
1423
                                    if (RefDepRec.DepartmentCode != CommonMotions.cnvInt(work[(int)ClickGetData.DepartmentCode]))
1424
                                    {
1425
                                        dgv.Rows[icnt].Visible = true;
1426
                                        dgv.Rows[icnt].Cells[(int)DispColumn.RowVisible].Value = 1;
1427
                                    }
1428
                                }
1429
                            }
1430

  
1431
                        }
1432
                    }
1433

  
1434
                    if (CommonMotions.cnvInt(work[(int)ClickGetData.ApprovalEndFlg]) == 1)
1435
                    {
1436
                        // ??I???F?????????F???????????A?S?????W?s??
1437
                        dgv.Rows[icnt].ReadOnly = true;
1438
                    }
1439
                    else if ((ApprovalPerson == true && m_UserInfo.m_Type == CommonDefine.SecurityRankPos.NormalAuthority)
1440
                          || (SekininApproval == true && m_UserInfo.m_Type == CommonDefine.SecurityRankPos.LimitedAuthority)
1441
                          || (SekininApproval == true && m_UserInfo.m_Type == CommonDefine.SecurityRankPos.FreeAuthority))
1442
                    {
1443
                        // ?H???S??????S??????F?????s?????????A?????@??C??????g????F?????s??????????A?H???S?????????W?s??
1444
                        dgv.Rows[icnt].Cells[(int)DispColumn.KojiSeikyu].ReadOnly = true;
1445
                        dgv.Rows[icnt].Cells[(int)DispColumn.KojiNebiki].ReadOnly = true;
1446
                        dgv.Rows[icnt].Cells[(int)DispColumn.KojiSousai].ReadOnly = true;
1447
                        dgv.Rows[icnt].Cells[(int)DispColumn.KojiKosoku].ReadOnly = true;
1448
                        dgv.Rows[icnt].Cells[(int)DispColumn.KojiKanamono].ReadOnly = true;
1449
                        dgv.Rows[icnt].Cells[(int)DispColumn.KojiSannhaiZei].ReadOnly = true;
1450
                        dgv.Rows[icnt].Cells[(int)DispColumn.KyoryokuUmu].ReadOnly = true;
1451
                    }
1452

  
1453
                    icnt++;
1454
                    iGoukeiSeq++;
1455

  
1456
                }
1457

  
1458
                // ????\??????????f?[?^?????`?F?b?N
1459
                iDataCount = dgv.Rows.Cast<DataGridViewRow>().Where(x => CommonMotions.cnvInt(x.Cells[(int)DispColumn.RowType].Value) == 0
1460
                                                                        && CommonMotions.cnvInt(x.Cells[(int)DispColumn.RowVisible].Value) == 1
1461
                                                                        && CommonMotions.cnvInt(x.Cells[m_GoukeiCode_Column].Value) == iGoukeiCd)
1462
                                                                .Count();
1463
                if (iDataCount > 0)
1464
                {
1465
                    // ???v?s???
1466
                    MakeGoukeiGyo(dgv, iGoukeiCd);
1467

  
1468
                    // ???v?l???
1469
                    setGoukei_DataDisp(dgv, iGoukeiCd);
1470
                }
1471

  
1472
                ResetNo();
1473

  
1474
                // ????F????~????F????\??
1475
                //??U???????????A?s??????X
1476
                int i;
1477
                for (i = (int)DispColumn.Shonin1; i < (int)DispColumn.Bikou; i+=5)
1478
                {
1479
                    dgv.Columns[i].Visible = true;
1480
                }
1481
                for (i = (int)DispColumn.Shonin1 + (iShoninMaxCount * 5); i < (int)DispColumn.Bikou; i++)
1482
                {
1483
                    dgv.Columns[i].Visible = false;
1484
                }
1485

  
1486
                // ?C?x???g?n???h????o?^
1487
                dgv.CellValueChanged += DataGridView_CellValueChanged;
1488

  
1489
                // ?{?^??????
1490
                controlButton();
1491
                controlButton_DataCount();
1492

  
1493
                // ?\?????f?[?^????
1494
                m_Select_DataCount = arData.Count;
1495

  
1496
                m_bChengeAns = false;
1497

  
1498
                return true;
1499
            }
1500
            catch (Exception ex)
1501
            {
1502
                logger.ErrorFormat("?V?X?e???G???[?F{0}?F{1}", CommonMotions.GetMethodName(), ex.Message);
1503
                return false;
1504
            }
1505
            finally
1506
            {
1507
                IoBd = null;
1508
                IoCbi = null;
1509
                IoMpic = null;
1510
            }
1511

  
1512
        }
1513
        #endregion
1514

  
1515 719
        #region ?x??????f?[?^?m?F
1516 720
        /// <summary>
1517 721
        /// ?x??????f?[?^?m?F
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/Request/RequestSummaryList/FrmRequestSummaryListAuxiliary.cs
85 85
                column2.ValueMember = "Key";
86 86
                column2.DisplayMember = "Value";
87 87

  
88
                if (cmbTargetMonth.SelectedValue == null || cmbTargetMonth.SelectedValue.ToString().Length!=6) return;
88
                if (cmbTargetMonth.SelectedValue == null || cmbTargetMonth.SelectedValue.ToString().Length != 6) return;
89 89

  
90 90
                // ?x???????
91 91
                DateTime deadLine = new DateTime(), payDate = new DateTime(), currentYearMonth = new DateTime();
......
1489 1489
            }
1490 1490
        }
1491 1491
        #endregion
1492

  
1493

  
1494
        #region ?O???b?h?\??
1495
        /// <summary>
1496
        /// ?O???b?h?\??
1497
        /// </summary>
1498
        /// <returns></returns>
1499
        private bool DispGridData()
1500
        {
1501
            IOBillingData IoBd = new IOBillingData();
1502
            ArrayList arData = new ArrayList();
1503

  
1504
            int DataGoukeiCd_Column = 0;
1505
            int iShoninColumn = 0;
1506

  
1507
            List<ShoninData> lstDefaultShonin = new List<ShoninData>();
1508
            List<PaymentApprovalInfo> PaIList = new List<PaymentApprovalInfo>();
1509
            PaymentApprovalInfo PaInfo = null;
1510

  
1511
            IOConstructionBaseInfo IoCbi = new IOConstructionBaseInfo();
1512
            IOMPersonInCharge IoMpic = new IOMPersonInCharge();
1513
            ConstructionBaseInfo Cbi = new ConstructionBaseInfo();
1514
            PersonInChargeMaster Picm = new PersonInChargeMaster();
1515
            string KojiTanto = "", KojiTantoCode = "";
1516
            int ConstrDepartmentCode = 0;
1517

  
1518
            // ?N??????m?F // TODO
1519
            if (ClsExcute.ProcControlPara.Count > 0)
1520
            {
1521
                for (int i = 0; i < ClsExcute.ProcControlPara.Count; i++)
1522
                {
1523
                    if ((ClsExcute.ProcControlPara[i].ArrayParameter != null) 
1524
                        && (ClsExcute.ProcControlPara[i].ArrayParameter.Count > 0))
1525
                    {
1526
                        ArrayList obj = ClsExcute.ProcControlPara[i].ArrayParameter[0];
1527
                        PaInfo = (PaymentApprovalInfo)obj[0];
1528
                        if (PaInfo is PaymentApprovalInfo != true)
1529
                        {
1530
                            PaInfo = null;
1531
                        }
1532
                    }
1533
                }
1534
            }
1535

  
1536
            try
1537
            {
1538

  
1539
                DataGridView dgv = getShowingView();
1540

  
1541
                // ???v?l?s?Z?o??P??
1542
                if (m_viewTarget == 0)
1543
                {
1544
                    DataGoukeiCd_Column = (int)ClickGetData.COMPANYCODE;
1545
                }
1546
                else
1547
                {
1548
                    DataGoukeiCd_Column = (int)ClickGetData.CONSTRUCTIONCODE;
1549
                }
1550

  
1551
                // ?????s??????
1552
                DataGridView_ReadOnlyChange(dgv);
1553

  
1554

  
1555
                // ?I?????????
1556
                m_Select_TargetDate = CommonMotions.cnvInt(cmbTargetMonth.SelectedValue);
1557

  
1558
                // ??U?Z????l??X?C?x???g????????
1559
                dgv.CellValueChanged -= DataGridView_CellValueChanged;
1560

  
1561
                // ?O???b?h??s??0????
1562
                dgv.Rows.Clear();
1563

  
1564
                // SQL??
1565
                StringBuilder sql = new StringBuilder();
1566
                if (PaInfo != null)
1567
                {
1568
                    // ?x?????F???f?[?^????SQL??
1569
                    CreateSQLType1(PaInfo, ref sql);
1570
                }
1571
                else
1572
                {
1573
                    // ?x?????F???f?[?^?L??SQL??
1574
                    CreateSQLType2(PaInfo, ref sql);
1575
                }
1576

  
1577
                if (dgvCompany.Visible == true)         // ???P??\??
1578
                {
1579
                    sql.AppendLine("order by CompanyCode ASC, SeqNo DESC, ");
1580
                    sql.AppendLine("case when ConstructionCode = 0 Then  2099999999 else LineCount end ");
1581
                }
1582
                else if (dgvProject.Visible == true)    // ????P??\??
1583
                {
1584
                    sql.AppendLine("order by ConstructionPersonCode ASC, ConstructionCode DESC, DisplayOrder ASC, SEQNO ASC, LineCount ASC ");
1585
                }
1586

  
1587
                // ?f?[?^???@???v?E???v???v?Z?????A?S???f?[?^????????
1588
                if (!IoBd.ExecuteReader(sql.ToString(), ref arData)) return false;
1589

  
1590
                // ?f?[?^?\??
1591
                int icnt = 0;
1592
                int iNo = 1;
1593
                int iGoukeiSeq = 0;
1594
                int iGoukeiCd = -1;
1595
                int iDataCount = 0;
1596
                int iShoninMaxCount = 0;
1597
                foreach (object[] work in arData)
1598
                {
1599
                    // ???v?s??
1600
                    if (iGoukeiCd != CommonMotions.cnvInt(work[DataGoukeiCd_Column]))
1601
                    {
1602
                        if (iGoukeiCd != -1)
1603
                        {
1604
                            // ????\??????????f?[?^?????`?F?b?N
1605
                            iDataCount = dgv.Rows.Cast<DataGridViewRow>().Where(x => CommonMotions.cnvInt(x.Cells[(int)DispColumn.RowType].Value) == 0
1606
                                                                                  && CommonMotions.cnvInt(x.Cells[(int)DispColumn.RowVisible].Value) == 1
1607
                                                                                  && CommonMotions.cnvInt(x.Cells[m_GoukeiCode_Column].Value) == iGoukeiCd)
1608
                                                                         .Count();
1609

  
1610
                            if (iDataCount > 0)
1611
                            {
1612
                                // ???v?s???
1613
                                MakeGoukeiGyo(dgv, iGoukeiCd);
1614
                                icnt += System.Enum.GetValues(typeof(GoukeiRows)).Length;
1615

  
1616
                                // ???v?l???
1617
                                setGoukei_DataDisp(dgv, iGoukeiCd);
1618

  
1619
                            }
1620
                            iNo++;
1621
                        }
1622
                        iGoukeiSeq = 1;
1623
                        iGoukeiCd = CommonMotions.cnvInt(work[DataGoukeiCd_Column]);
1624
                    }
1625

  
1626

  
1627
                    dgv.Rows.Add();
1628

  
1629
                    // ?O???b?h?f?[?^?Z?b?g
1630
                    SetGridData(icnt, iNo, iGoukeiSeq, work);
1631

  
1632
                    // ?S??????F
1633
                    bool ApprovalPerson = CommonMotions.cnvInt(work[(int)ClickGetData.ApprovalPersonCode]) != 0 ? true : false;
1634
                    bool SekininApproval = false;
1635
                    if (ApprovalPerson == true)
1636
                    {
1637
                        dgv.Rows[icnt].Cells[(int)DispColumn.TantoShoninCode].Value = CommonMotions.cnvInt(work[(int)ClickGetData.ApprovalPersonCode]);
1638
                        dgv.Rows[icnt].Cells[(int)DispColumn.TantoShonin].Value = CommonMotions.cnvString(work[(int)ClickGetData.TantoNM]);
1639
                        dgv.Rows[icnt].Cells[(int)DispColumn.TantoDate].Value = CommonMotions.cnvString(work[(int)ClickGetData.ApprovalDate]);
1640

  
1641
                        // ?S?????F??f?[?^
1642
                        iShoninColumn = (int)DispColumn.Shonin1Code;
1643
                        if (!GetShonin(CommonMotions.cnvInt(work[(int)ClickGetData.COMPANYCODE]),
1644
                                        CommonMotions.cnvInt(work[(int)ClickGetData.SEQNO]),
1645
                                        CommonMotions.cnvInt(work[(int)ClickGetData.LINECOUNT]),
1646
                                        ref PaIList)) return false;
1647
                        
1648
                        iShoninMaxCount = iShoninMaxCount < PaIList.Count ? PaIList.Count : iShoninMaxCount;
1649
                        foreach (PaymentApprovalInfo pair in PaIList)
1650
                        {
1651
                            dgv.Rows[icnt].Cells[iShoninColumn++].Value = pair.ApprovalPerson;
1652
                            if (pair.ApprovalDate == new DateTime(2001, 01, 01))
1653
                            {
1654
                                dgv.Rows[icnt].Cells[iShoninColumn].Style.ForeColor = Color.Gray;
1655
                            }
1656
                            else
1657
                            {
1658
                                // ???F??????F????????A????????
1659
                                if (SekininApproval == false 
1660
                                    && (m_UserInfo.m_Type == CommonDefine.SecurityRankPos.LimitedAuthority
1661
                                        || m_UserInfo.m_Type == CommonDefine.SecurityRankPos.FreeAuthority))
1662
                                {
1663
                                    if (CommonMotions.LoginUserData.PersonCode == pair.ApprovalPerson)
1664
                                    {
1665
                                        SekininApproval = true;
1666
                                    }
1667
                                }
1668
                            }
1669
                            dgv.Rows[icnt].Cells[iShoninColumn++].Value = pair.ApprovalPersonName;
1670
                            dgv.Rows[icnt].Cells[iShoninColumn++].Value = pair.ApprovalDate;
1671
                            dgv.Rows[icnt].Cells[iShoninColumn++].Value = pair.ApprovalAuthority;
1672
                            dgv.Rows[icnt].Cells[iShoninColumn++].Value = pair.ApprovalNo;
1673
                        }
1674

  
1675
                    }
1676
                    else
1677
                    {
1678
                        //???????????????????F
1679
                        if (CommonMotions.cnvInt(dgv.Rows[icnt].Cells[m_Genba_Column].Value) != 0)
1680
                        {
1681
                            // ?I???????H????H???S??????????????????
1682

  
1683
                            string sWhere = IoCbi.CreatePrimarykeyString(CommonMotions.cnvInt(dgv.Rows[icnt].Cells[m_Genba_Column].Value));
1684
                            if (!IoCbi.SelectAction(sWhere, ref Cbi)) throw new Exception("?H????{?????G???[");
1685

  
1686
                            sWhere = IoMpic.CreatePrimarykeyString(Cbi.ConstructionPersonCode);
1687
                            if (!IoMpic.SelectAction(sWhere, ref Picm)) throw new Exception("?S????}?X?^???G???[");
1688
                            ConstrDepartmentCode = Picm.DepartmentCode;
1689

  
1690
                            //?H???S????
1691
                            KojiTantoCode = Picm.PersonCode.ToString();
1692
                            KojiTanto = Picm.SealPrintName;
1693

  
1694
                            //?S??????F???
1695
                            dgv.Rows[icnt].Cells[(int)DispColumn.TantoShoninCode].Value = KojiTantoCode;
1696
                            dgv.Rows[icnt].Cells[(int)DispColumn.TantoShonin].Value = KojiTanto;
1697
                            dgv.Rows[icnt].Cells[(int)DispColumn.TantoShonin].Style.ForeColor = Color.Gray;
1698

  
1699
                            // ?S????????F?f?[?^
1700
                            int iDefaultDataCount = 0;
1701
                            if (!SetDefaultShonin(dgv, icnt, ConstrDepartmentCode, ref iDefaultDataCount)) return false;
1702
                            iShoninMaxCount = iShoninMaxCount < iDefaultDataCount ? iDefaultDataCount : iShoninMaxCount;
1703
                        }
1704
                        else
1705
                        {
1706
                            dgv.Rows[icnt].Cells[(int)DispColumn.TantoShoninCode].Value = "";
1707
                            dgv.Rows[icnt].Cells[(int)DispColumn.TantoShonin].Value = "";
1708
                            dgv.Rows[icnt].Cells[(int)DispColumn.TantoShonin].Style.ForeColor = Color.Gray;
1709
                        }
1710

  
1711
                    }
1712

  
1713
                    // ???l???
1714
                    dgv.Rows[icnt].Cells[(int)DispColumn.Bikou].Value = CommonMotions.cnvString(work[(int)ClickGetData.Bikou]);
1715
                    // ?H????????s????A????????
1716
                    dgv.Rows[icnt].Cells[(int)DispColumn.ConstructionLedgerLineNo].Value = CommonMotions.cnvString(work[(int)ClickGetData.ConstructionLedgerLineNo]);
1717
                    dgv.Rows[icnt].Cells[(int)DispColumn.ConstructionLedgerRowNo].Value = CommonMotions.cnvString(work[(int)ClickGetData.ConstructionLedgerRowNo]);
1718

  
1719
                    // ??????????\????\??
1720
                    // ?????l????
1721
                    dgv.Rows[icnt].Visible = true;
1722
                    dgv.Rows[icnt].Cells[(int)DispColumn.RowVisible].Value = 1;
1723

  
1724
                    // ?s????O
1725
                    if (CommonMotions.cnvInt(work[(int)ClickGetData.CONSTRUCTIONCODE]) != 0)
1726
                    {
1727
                        // ?s????O???U?s????????
1728
                        dgv.Rows[icnt].Visible = false;
1729
                        dgv.Rows[icnt].Cells[(int)DispColumn.RowVisible].Value = 0;
1730

  
1731
                        // ?????S??
1732
                        if (m_UserInfo.m_GeneralAffairsFlg == 1)
1733
                        {
1734
                            // ?????????W????S??????Q?????\????A??W??\???????????????????????B
1735
                            dgv.Rows[icnt].Visible = true;
1736
                            dgv.Rows[icnt].Cells[(int)DispColumn.RowVisible].Value = 1;
1737
                        }
1738
                        // ??????????
1739
                        else if (m_UserInfo.m_Type == CommonDefine.SecurityRankPos.SpecialAuthority)
1740
                        {
1741
                            // ?????????W????S??????Q?????\????A??????????????O???W??\?????B
1742
                            dgv.Rows[icnt].Visible = true;
1743
                            dgv.Rows[icnt].Cells[(int)DispColumn.RowVisible].Value = 1;
1744
                        }
1745
                        // ???????A????????
1746
                        else if (m_UserInfo.m_Type == CommonDefine.SecurityRankPos.LimitedAuthority || m_UserInfo.m_Type == CommonDefine.SecurityRankPos.FreeAuthority)
1747
                        {
1748
                            // ?Q????????????`?F?b?N
1749
                            foreach (PersonDepartmentMaster RefDepRec in CommonMotions.LoginUserDepartment)
1750
                            {
1751
                                // ??????????????????????H?????\??????
1752
                                if (RefDepRec.DepartmentCode != CommonMotions.cnvInt(work[(int)ClickGetData.DepartmentCode]))
1753
                                {
1754
                                    dgv.Rows[icnt].Visible = true;
1755
                                    dgv.Rows[icnt].Cells[(int)DispColumn.RowVisible].Value = 1;
1756
                                }
1757
                            }
1758
                        }
1759
                        // ?S??????
1760
                        else if (m_UserInfo.m_Type == CommonDefine.SecurityRankPos.NormalAuthority)
1761
                        {
1762
                            if (m_UserInfo.m_SecRange == ClsSecurityPermission.SecRangeType.InCharge)
1763
                            {
1764
                                // ?c??S??
1765
                                if (CommonMotions.LoginUserData.PersonCode == CommonMotions.cnvInt(work[(int)ClickGetData.SalesPersonCode]))
1766
                                {
1767
                                    dgv.Rows[icnt].Visible = true;
1768
                                    dgv.Rows[icnt].Cells[(int)DispColumn.RowVisible].Value = 1;
1769
                                }
1770
                                // ?H???S??
1771
                                if (CommonMotions.LoginUserData.PersonCode == CommonMotions.cnvInt(work[(int)ClickGetData.ConstructionPersonCode])
1772
                                    || CommonMotions.LoginUserData.PersonCode == CommonMotions.cnvInt(work[(int)ClickGetData.ConstrSubPersonCode])
1773
                                    || CommonMotions.LoginUserData.PersonCode == CommonMotions.cnvInt(work[(int)ClickGetData.ConstructionInstructor]))
1774
                                {
1775
                                    dgv.Rows[icnt].Visible = true;
1776
                                    dgv.Rows[icnt].Cells[(int)DispColumn.RowVisible].Value = 1;
1777
                                }
1778
                            }
1779
                            else if (m_UserInfo.m_SecRange == ClsSecurityPermission.SecRangeType.OneDepartment)
1780
                            {
1781
                                // ?Q????????????`?F?b?N
1782
                                foreach (PersonDepartmentMaster RefDepRec in CommonMotions.LoginUserDepartment)
1783
                                {
1784
                                    // ??????????????????????H?????\??????
1785
                                    if (RefDepRec.DepartmentCode != CommonMotions.cnvInt(work[(int)ClickGetData.DepartmentCode]))
1786
                                    {
1787
                                        dgv.Rows[icnt].Visible = true;
1788
                                        dgv.Rows[icnt].Cells[(int)DispColumn.RowVisible].Value = 1;
1789
                                    }
1790
                                }
1791
                            }
1792
                        }
1793
                    }
1794

  
1795
                    if (CommonMotions.cnvInt(work[(int)ClickGetData.ApprovalEndFlg]) == 1)
1796
                    {
1797
                        // ??I???F?????????F???????????A?S?????W?s??
1798
                        dgv.Rows[icnt].ReadOnly = true;
1799
                    }
1800
                    else if ((ApprovalPerson == true && m_UserInfo.m_Type == CommonDefine.SecurityRankPos.NormalAuthority)
1801
                          || (SekininApproval == true && m_UserInfo.m_Type == CommonDefine.SecurityRankPos.LimitedAuthority)
1802
                          || (SekininApproval == true && m_UserInfo.m_Type == CommonDefine.SecurityRankPos.FreeAuthority))
1803
                    {
1804
                        // ?H???S??????S??????F?????s?????????A?????@??C??????g????F?????s??????????A?H???S?????????W?s??
1805
                        dgv.Rows[icnt].Cells[(int)DispColumn.KojiSeikyu].ReadOnly = true;
1806
                        dgv.Rows[icnt].Cells[(int)DispColumn.KojiNebiki].ReadOnly = true;
1807
                        dgv.Rows[icnt].Cells[(int)DispColumn.KojiSousai].ReadOnly = true;
1808
                        dgv.Rows[icnt].Cells[(int)DispColumn.KojiKosoku].ReadOnly = true;
1809
                        dgv.Rows[icnt].Cells[(int)DispColumn.KojiKanamono].ReadOnly = true;
1810
                        dgv.Rows[icnt].Cells[(int)DispColumn.KojiSannhaiZei].ReadOnly = true;
1811
                        dgv.Rows[icnt].Cells[(int)DispColumn.KyoryokuUmu].ReadOnly = true;
1812
                    }
1813

  
1814
                    icnt++;
1815
                    iGoukeiSeq++;
1816

  
1817
                }
1818

  
1819
                // ????\??????????f?[?^?????`?F?b?N
1820
                iDataCount = dgv.Rows.Cast<DataGridViewRow>().Where(x => CommonMotions.cnvInt(x.Cells[(int)DispColumn.RowType].Value) == 0
1821
                                                                        && CommonMotions.cnvInt(x.Cells[(int)DispColumn.RowVisible].Value) == 1
1822
                                                                        && CommonMotions.cnvInt(x.Cells[m_GoukeiCode_Column].Value) == iGoukeiCd)
1823
                                                                .Count();
1824
                if (iDataCount > 0)
1825
                {
1826
                    // ???v?s???
1827
                    MakeGoukeiGyo(dgv, iGoukeiCd);
1828

  
1829
                    // ???v?l???
1830
                    setGoukei_DataDisp(dgv, iGoukeiCd);
1831
                }
1832

  
1833
                ResetNo();
1834

  
1835
                // ????F????~????F????\??
1836
                //??U???????????A?s??????X
1837
                int i;
1838
                for (i = (int)DispColumn.Shonin1; i < (int)DispColumn.Bikou; i += 5)
1839
                {
1840
                    dgv.Columns[i].Visible = true;
1841
                }
1842
                for (i = (int)DispColumn.Shonin1 + (iShoninMaxCount * 5); i < (int)DispColumn.Bikou; i++)
1843
                {
1844
                    dgv.Columns[i].Visible = false;
1845
                }
1846

  
1847
                // ?C?x???g?n???h????o?^
1848
                dgv.CellValueChanged += DataGridView_CellValueChanged;
1849

  
1850
                // ?{?^??????
1851
                controlButton();
1852
                controlButton_DataCount();
1853

  
1854
                // ?\?????f?[?^????
1855
                m_Select_DataCount = arData.Count;
1856

  
1857
                m_bChengeAns = false;
1858

  
1859
                return true;
1860
            }
1861
            catch (Exception ex)
1862
            {
1863
                logger.ErrorFormat("?V?X?e???G???[?F{0}?F{1}", CommonMotions.GetMethodName(), ex.Message);
1864
                return false;
1865
            }
1866
            finally
1867
            {
1868
                IoBd.close(); IoBd = null;
1869
                IoCbi.close(); IoCbi = null;
1870
                IoMpic.close(); IoMpic = null;
1871
            }
1872
        }
1873
        #endregion
1874

  
1875
        #region ?O???b?h?f?[?^?Z?b?g
1876
        /// <summary>
1877
        /// ?O???b?h?f?[?^?Z?b?g
1878
        /// </summary>
1879
        /// <param name="icnt"></param>
1880
        /// <param name="iNo"></param>
1881
        /// <param name="iGoukeiSeq"></param>
1882
        /// <param name="work"></param>
1883
        private void SetGridData(int icnt, int iNo, int iGoukeiSeq, object[] work)
1884
        {
1885
            try
1886
            {
1887
                DataGridView dgv = getShowingView();
1888

  
1889
                dgv.Rows[icnt].Cells[(int)DispColumn.CompanyDispOrder].Value = CommonMotions.cnvInt(work[(int)ClickGetData.DisplayOrder]);
1890
                dgv.Rows[icnt].Cells[(int)DispColumn.ApprovalEndFlg].Value = CommonMotions.cnvInt(work[(int)ClickGetData.ApprovalEndFlg]);
1891
                dgv.Rows[icnt].Cells[(int)DispColumn.UpdateDate].Value = CommonMotions.cnvString(work[(int)ClickGetData.UpdateDate]);
1892

  
1893
                dgv.Rows[icnt].Cells[(int)DispColumn.RowState].Value = DataRowState.Modified;
1894
                dgv.Rows[icnt].Cells[(int)DispColumn.RowType].Value = 0;
1895
                dgv.Rows[icnt].Cells[(int)DispColumn.GoukeiSeqNo].Value = iGoukeiSeq;
1896
                dgv.Rows[icnt].Cells[(int)DispColumn.GroupSeqNo].Value = CommonMotions.cnvInt(work[(int)ClickGetData.SEQNO]);
1897
                dgv.Rows[icnt].Cells[(int)DispColumn.LineCount].Value = CommonMotions.cnvInt(work[(int)ClickGetData.LINECOUNT]);
1898
                dgv.Rows[icnt].Cells[(int)DispColumn.No].Value = iNo;
1899

  
1900
                dgv.Rows[icnt].Cells[m_Company_Column].Value = CommonMotions.cnvInt(work[(int)ClickGetData.COMPANYCODE]);
1901
                dgv.Rows[icnt].Cells[m_CompanyNM_Column].Value = CommonMotions.cnvString(work[(int)ClickGetData.COMPANYNAME]);
1902
                dgv.Rows[icnt].Cells[m_CompanyNM_Column].ToolTipText = CommonMotions.cnvString(work[(int)ClickGetData.COMPANYNAME]);
1903
                dgv.Rows[icnt].Cells[m_Genba_Column].Value = CommonMotions.cnvInt(work[(int)ClickGetData.CONSTRUCTIONCODE]);
1904
                dgv.Rows[icnt].Cells[m_GenbaNM_Column].Value = CommonMotions.cnvString(work[(int)ClickGetData.FIELDNAME]);
1905
                dgv.Rows[icnt].Cells[m_GenbaNM_Column].ToolTipText = CommonMotions.cnvString(work[(int)ClickGetData.FIELDNAME]);
1906

  
1907
                dgv.Rows[icnt].Cells[(int)DispColumn.SomuSeikyu].Value = CommonMotions.cnvInt(work[(int)ClickGetData.BILLPRICE]);
1908
                dgv.Rows[icnt].Cells[(int)DispColumn.SomuKosoku].Value = CommonMotions.cnvInt(work[(int)ClickGetData.HIGHWPRICE]);
1909
                dgv.Rows[icnt].Cells[(int)DispColumn.SomuKanamono].Value = CommonMotions.cnvInt(work[(int)ClickGetData.HARDWPRICE]);
1910
                dgv.Rows[icnt].Cells[(int)DispColumn.SomuSannhaiZei].Value = CommonMotions.cnvInt(work[(int)ClickGetData.INDSWASTETAX]);
1911

  
1912
                dgv.Rows[icnt].Cells[(int)DispColumn.KojiSeikyu].Value = CommonMotions.cnvInt(work[(int)ClickGetData.KojiSeikyu]);
1913

  
1914
                dgv.Rows[icnt].Cells[(int)DispColumn.KojiNebiki].Value = CommonMotions.cnvInt(work[(int)ClickGetData.KojiNebiki]);
1915
                dgv.Rows[icnt].Cells[(int)DispColumn.KojiSousai].Value = CommonMotions.cnvInt(work[(int)ClickGetData.KojiSousai]);
1916
                dgv.Rows[icnt].Cells[(int)DispColumn.JikaiKurikosi].Value = CommonMotions.cnvInt(work[(int)ClickGetData.JikaiKurikosi]);
1917

  
1918
                dgv.Rows[icnt].Cells[(int)DispColumn.KojiKosoku].Value = CommonMotions.cnvInt(work[(int)ClickGetData.KojiKosoku]);
1919
                dgv.Rows[icnt].Cells[(int)DispColumn.KojiKanamono].Value = CommonMotions.cnvInt(work[(int)ClickGetData.KojiKanamono]);
1920
                dgv.Rows[icnt].Cells[(int)DispColumn.KojiSannhaiZei].Value = CommonMotions.cnvInt(work[(int)ClickGetData.KojiSannhaiZei]);
1921

  
1922
                dgv.Rows[icnt].Cells[(int)DispColumn.KyoryokuKin].Value = CommonMotions.cnvInt(work[(int)ClickGetData.CnstrPrice]);
1923
                dgv.Rows[icnt].Cells[(int)DispColumn.KyoryokuUmu].Value = CommonMotions.cnvInt(work[(int)ClickGetData.CNSTRPRICEEXIST]);
1924

  
1925
                dgv.Rows[icnt].Cells[(int)DispColumn.CyuumonshoTeisyutu].Value = CommonMotions.cnvString(work[(int)ClickGetData.PurchaseOrderMailingDate]);
1926
                dgv.Rows[icnt].Cells[(int)DispColumn.CyuumonshoTouchaku].Value = CommonMotions.cnvString(work[(int)ClickGetData.PurchaseOrderReturnDate]);
1927
                dgv.Rows[icnt].Cells[(int)DispColumn.YosanSho].Value = CommonMotions.cnvString(work[(int)ClickGetData.PaData]);
1928
            }
1929
            catch (Exception ex)
1930
            {
1931
                logger.ErrorFormat("?V?X?e???G???[?F{0}?F{1}", CommonMotions.GetMethodName(), ex.Message);
1932
            }
1933
        }
1934
        #endregion
1935

  
1936
        #region ?f?[?^??SQL???i?x?????F????j
1937
        /// <summary>
1938
        /// ?f?[?^??SQL???i?x?????F????j
1939
        /// </summary>
1940
        /// <param name="PaInfo"></param>
1941
        /// <param name="sql"></param>
1942
        private void CreateSQLType1(PaymentApprovalInfo PaInfo, ref StringBuilder sql)
1943
        {
1944
            try
1945
            {
1946
                sql.Append("select ");
1947
                sql.Append("  ifnull(Bd.SeqNo, 1) as SeqNo ");
1948
                sql.Append("  , ifnull(Bdd.LineCount, 0) as LineCount ");
1949
                sql.Append("  , ifnull(Bdd.CompanyCode, 0) as CompanyCode ");
1950
                sql.Append("  , ifnull(Scm.CompanyName, \"\") as CompanyName ");
1951
                sql.Append("  , Scm.DisplayOrder as DisplayOrder ");
1952
                sql.Append("  , Bdd.ConstructionCode as ConstructionCode ");
1953
                sql.Append("  , Bdd.FieldName as FieldName ");
1954
                sql.Append("  , Bdd.BillPrice as BillPrice ");
1955
                sql.Append("  , Bdd.HighwPrice as HighwPrice ");
1956
                sql.Append("  , Bdd.HardwPrice as HardwPrice ");
1957
                sql.Append("  , Bdd.IndswasteTax as IndswasteTax ");
1958
                sql.Append("  , DATE_FORMAT(Bdd.UpdateDate, '%Y/%m/%d %H:%i:%s') as UpdateDate ");
1959
                sql.Append("  , ifnull(Bdd.Note, '') as Bikou ");
1960
                sql.Append("  , ifnull(Pdd.BillPrice, 0) as KojiSeikyu ");
1961
                sql.Append("  , ifnull(Pdd.DiscountPrice, 0) as KojiNebiki ");
1962
                sql.Append("  , ifnull(Pdd.OffsetPrice, 0) as KojiSousai ");
1963
                sql.Append("  , ifnull(Pdd.NextCoPrice, 0) as JikaiKurikosi ");
1964
                sql.Append("  , ifnull(Pdd.HighwPrice, 0) as KojiKousoku ");
1965
                sql.Append("  , ifnull(Pdd.HardwPrice, 0) as KojiKanamono ");
1966
                sql.Append("  , ifnull(Pdd.IndswasteTax, 0) as KojiSannhaiZei ");
1967
                sql.Append("  , ifnull(Pdd.CnstrPrice, 0) as CnstrPrice ");
1968
                sql.Append("  , ifnull(Pdd.CnstrPriceExist, - 1) as CnstrPriceExist ");
1969
                sql.Append("  , ifnull(Pdd.ApprovalPersonCode, 0) as ApprovalPersonCode ");
1970
                sql.Append("  , ifnull(Picm.SealPrintName, '') as TantoNM ");
1971
                sql.Append("  , DATE_FORMAT( ");
1972
                sql.Append("    ifnull(Pdd.ApprovalDate, '2001/01/01') ");
1973
                sql.Append("    , '%Y/%m/%d' ");
1974
                sql.Append("  ) as ApprovalDate ");
1975
                sql.Append("  , ifnull(Pdd.ApprovalEndFlg, 0) as ApprovalEndFlg ");
1976
                sql.Append("  , ifnull(Cbi.SalesPersonCode, 0) as SalesPersonCode ");
1977
                sql.Append("  , ifnull(Cbi.ConstructionPersonCode, 0) as ConstructionPersonCode ");
1978
                sql.Append("  , ifnull(Cbi.ConstrSubPersonCode, 0) as ConstrSubPersonCode ");
1979
                sql.Append("  , ifnull(Cbi.ConstructionInstructor, 0) as ConstructionInstructor ");
1980
                sql.Append("  , Picm2.DepartmentCode ");
1981
                sql.Append("  , case ifnull(Pod.SendDate, '') ");
1982
                sql.Append("    when '' then '?~' ");
1983
                sql.Append("    when '2001/01/01' then '?~' ");
1984
                sql.Append("    else '??' ");
1985
                sql.Append("    end as PurchaseOrderMailingDate ");
1986
                sql.Append("  , case ifnull(Pod.ReturnCheckDate, '') ");
1987
                sql.Append("    when '' then '?~' ");
1988
                sql.Append("    when '2001/01/01' then '?~' ");
1989
                sql.Append("    else '??' ");
1990
                sql.Append("    end as PurchaseOrderReturnDate ");
1991
                sql.Append("  , case ifnull(Pa.PersonCode, 0) ");
1992
                sql.Append("    when 0 then case Bdd.ConstructionCode ");
1993
                sql.Append("      when 0 then '' ");
1994
                sql.Append("      else '?~' ");
1995
                sql.Append("      end ");
1996
                sql.Append("    else '??' ");
1997
                sql.Append("    end as PaData ");
1998
                sql.Append("  , null as LinePoint ");
1999
                sql.Append("  , null as ColPoint ");
2000
                sql.Append("from ");
2001
                sql.Append("  BillingData as Bd join ( ");
2002
                sql.Append("    BillingDataDetail as Bdd join SubContractorMaster as Scm ");
2003
                sql.Append("      on Bdd.CompanyCode = Scm.CompanyCode ");
2004
                sql.AppendFormat("      and Scm.LabourKind = {0} ", m_Labourkind);
2005
                sql.Append("      left join ( ");
2006
                sql.Append("        PaymentDataDetail as Pdd ");
2007
                sql.Append("          left join PersonInChargeMaster as Picm ");
2008
                sql.Append("            on ifnull(Pdd.ApprovalPersonCode, - 1) = Picm.PersonCode ");
2009
                sql.Append("      ) ");
2010
                sql.Append("        on Bdd.CompanyCode = Pdd.CompanyCode ");
2011
                sql.Append("        and Bdd.TargetDate = Pdd.TargetDate ");
2012
                sql.Append("        and Bdd.SeqNo = Pdd.SeqNo ");
2013
                sql.Append("        and Bdd.LineCount = Pdd.LineCount ");
2014
                sql.Append("      left join ( ");
2015
                sql.Append("        ConstructionBaseInfo as Cbi ");
2016
                sql.Append("          left join ( ");
2017
                sql.Append("            PersonInChargeMaster as Picm2 ");
2018
                sql.Append("              left join ApprovalMaster as Am ");
2019
                sql.Append("                on Picm2.DepartmentCode = Am.DepartmentCode ");
2020
                sql.Append("                and Am.ApprovalCode = 3 ");
2021
                sql.Append("                and ApprovalAuthority = 1 ");
2022
                sql.Append("          ) ");
2023
                sql.Append("            on Cbi.ConstructionPersonCode = Picm2.PersonCode ");
2024
                sql.Append("          left join ProcessApproval as Pa ");
2025
                sql.Append("            on Cbi.ConstructionCode = Pa.ConstructionCode ");
2026
                sql.Append("            and Am.ApprovalPerson = Pa.PersonCode ");
2027
                sql.Append("            and Pa.SeqNo > 1 ");
2028
                sql.Append("            and Pa.ApprovalStatus = 2 ");
2029
                sql.Append("      ) ");
2030
                sql.Append("        on Bdd.ConstructionCode = Cbi.ConstructionCode ");
2031
                sql.Append("  ) ");
2032
                sql.Append("       on Bd.CompanyCode = Bdd.CompanyCode ");
2033
                sql.Append("       and Bd.TargetDate = Bdd.TargetDate ");
2034
                sql.Append("       and Bd.SeqNo = Bdd.SeqNo ");
2035
                sql.AppendFormat(" and Bd.TargetDate = {0} ", PaInfo.TargetDate);
2036
                sql.Append("  left join ( ");
2037
                sql.Append("    PurchaseOrderDate as Pod ");
2038
                sql.Append("  ) on Bd.CompanyCode = Pod.CompanyCode ");
2039
                sql.Append("  and Bdd.ConstructionCode = Pod.ConstructionCode ");
2040

  
2041
                sql.Append(" ");
2042

  
2043
                sql.Append("group by ");
2044
                sql.Append("  SeqNo ");
2045
                sql.Append("  , LineCount ");
2046
                sql.Append("  , CompanyCode ");
2047
                sql.Append("  , CompanyName ");
2048
                sql.Append("  , DisplayOrder ");
2049
                sql.Append("  , ConstructionCode ");
2050
                sql.Append("  , FieldName ");
2051
                sql.Append("  , BillPrice ");
2052
                sql.Append("  , HighwPrice ");
2053
                sql.Append("  , Hardwprice ");
2054
                sql.Append("  , IndswasteTax ");
2055
                sql.Append("  , UpdateDate ");
2056
                sql.Append("  , Bikou ");
2057
                sql.Append("  , KojiSeikyu ");
2058
                sql.Append("  , KojiNebiki ");
2059
                sql.Append("  , KojiSousai ");
2060
                sql.Append("  , JikaiKurikosi ");
2061
                sql.Append("  , KojiKousoku ");
2062
                sql.Append("  , KojiKanamono ");
2063
                sql.Append("  , KojiSannhaiZei ");
2064
                sql.Append("  , CnstrPrice ");
2065
                sql.Append("  , CnstrpriceExist ");
2066
                sql.Append("  , ApprovalPersonCode ");
2067
                sql.Append("  , TantoNM ");
2068
                sql.Append("  , ApprovalDate ");
2069
                sql.Append("  , ApprovalEndFlg ");
2070
                sql.Append("  , SalesPersonCode ");
2071
                sql.Append("  , ConstructionPersonCode ");
2072
                sql.Append("  , ConstrSubPersonCode ");
2073
                sql.Append("  , ConstructionInstructor ");
2074
                sql.Append("  , DepartmentCode ");
2075
                sql.Append("  , PurchaseOrderMailingDate ");
2076
                sql.Append("  , PurchaseOrderReturnDate ");
2077
                sql.Append("  , PaData ");
2078
                sql.Append("  , LinePoint ");
2079
                sql.Append("  , ColPoint ");
2080
            }
2081
            catch (Exception ex)
2082
            {
2083
                logger.ErrorFormat("?V?X?e???G???[?F{0}?F{1}", CommonMotions.GetMethodName(), ex.Message);
2084
            }
2085
        }
2086
        #endregion
2087

  
2088
        #region ?f?[?^??SQL???i?x?????F????j
2089
        /// <summary>
2090
        /// ?f?[?^??SQL???i?x?????F????j
2091
        /// </summary>
2092
        /// <param name="PaInfo"></param>
2093
        /// <param name="sql"></param>
2094
        private void CreateSQLType2(PaymentApprovalInfo PaInfo, ref StringBuilder sql)
2095
        {
2096
            try
2097
            {
2098
                sql.Append("select ");
2099
                sql.Append("  ifnull(Bd.SeqNo, 1) as SeqNo ");
2100
                sql.Append("  , ifnull(Bdd.LineCount, 0) as LineCount ");
2101
                sql.Append("  , ifnull(Bdd.CompanyCode, Cld.CompanyCode) as CompanyCode ");
2102
                sql.Append("  , ifnull(Scm.CompanyName, Cld.CompanyName) as CompanyName ");
2103
                sql.Append("  , Sc.DisplayOrder as DisplayOrder ");
2104
                sql.Append("  , ifnull(Bdd.ConstructionCode, Cl.ConstructionCode) as ConstructionCode ");
2105
                sql.Append("  , ifnull(Bdd.FieldName, Cbd.DetailString) as FieldName ");
2106
                sql.Append("  , Bdd.BillPrice as BillPrice ");
2107
                sql.Append("  , Bdd.HighwPrice as HighwPrice ");
2108
                sql.Append("  , Bdd.HardwPrice as HardwPrice ");
2109
                sql.Append("  , Bdd.IndswasteTax as IndswasteTax ");
2110
                sql.Append("  , DATE_FORMAT(Bdd.UpdateDate, '%Y/%m/%d %H:%i:%s') as UpdateDate ");
2111
                sql.Append("  , ifnull(Bdd.Note, '') as Bikou ");
2112
                sql.Append("  , ifnull(Pdd.BillPrice, 0) as KojiSeikyu ");
2113
                sql.Append("  , ifnull(Pdd.DiscountPrice, 0) as KojiNebiki ");
2114
                sql.Append("  , ifnull(Pdd.OffsetPrice, 0) as KojiSousai ");
2115
                sql.Append("  , ifnull(Pdd.NextCoPrice, 0) as JikaiKurikosi ");
2116
                sql.Append("  , ifnull(Pdd.HighwPrice, 0) as KojiKousoku ");
2117
                sql.Append("  , ifnull(Pdd.HardwPrice, 0) as KojiKanamono ");
2118
                sql.Append("  , ifnull(Pdd.IndswasteTax, 0) as KojiSannhaiZei ");
2119
                sql.Append("  , ifnull(Pdd.CnstrPrice, 0) as CnstrPrice ");
2120
                sql.Append("  , ifnull(Pdd.CnstrPriceExist, - 1) as CnstrPriceExist ");
2121
                sql.Append("  , ifnull(Pdd.ApprovalPersonCode, 0) as ApprovalPersonCode ");
2122
                sql.Append("  , ifnull(Picm.SealPrintName, '') as TantoNM ");
2123
                sql.Append("  , DATE_FORMAT( ");
2124
                sql.Append("    ifnull(Pdd.ApprovalDate, '2001/01/01') ");
2125
                sql.Append("    , '%Y/%m/%d' ");
2126
                sql.Append("  ) as ApprovalDate ");
2127
                sql.Append("  , ifnull(Pdd.ApprovalEndFlg, 0) as ApprovalEndFlg ");
2128
                sql.Append("  , ifnull(Cbi.SalesPersonCode, 0) as SalesPersonCode ");
2129
                sql.Append("  , ifnull(Cbi.ConstructionPersonCode, 0) as ConstructionPersonCode ");
2130
                sql.Append("  , ifnull(Cbi.ConstrSubPersonCode, 0) as ConstrSubPersonCode ");
2131
                sql.Append("  , ifnull(Cbi.ConstructionInstructor, 0) as ConstructionInstructor ");
2132
                sql.Append("  , Picm2.DepartmentCode ");
2133
                sql.Append("  , case ifnull(Pod.SendDate, '') ");
2134
                sql.Append("    when '' then '?~' ");
2135
                sql.Append("    when '2001/01/01' then '?~' ");
2136
                sql.Append("    else '??' ");
2137
                sql.Append("    end as PurchaseOrderMailingDate ");
2138
                sql.Append("  , case ifnull(Pod.ReturnCheckDate, '') ");
2139
                sql.Append("    when '' then '?~' ");
2140
                sql.Append("    when '2001/01/01' then '?~' ");
2141
                sql.Append("    else '??' ");
2142
                sql.Append("    end as PurchaseOrderReturnDate ");
2143
                sql.Append("  , case ifnull(Pa.PersonCode, 0) ");
2144
                sql.Append("    when 0 then case Cld.ConstructionCode ");
2145
                sql.Append("      when 0 then '' ");
2146
                sql.Append("      else '?~' ");
2147
                sql.Append("      end ");
2148
                sql.Append("    else '??' ");
2149
                sql.Append("    end as PaData ");
2150
                sql.Append("  , Cld.LineCount as LinePoint ");
2151
                sql.AppendFormat("  , PERIOD_DIFF({0} ,DATE_FORMAT(Cl.ConstructionStart, '%Y%m')) + {1} AS ColPoint ", m_Select_TargetDate, Enum.GetNames(typeof(FrmConstructionLedger.GridColumn)).Length - 1);
2152
                sql.Append("from ");
2153
                sql.Append("  ConstructionLedgerDetail as Cld ");
2154
                sql.Append("  inner join ConstructionLedger as Cl on Cl.ConstructionCode = Cld.ConstructionCode ");
2155
                sql.Append("    and Cl.ComplateFlg = 0 ");
2156
                sql.Append("  inner join ConstructionBaseinfoDetail as Cbd on Cbd.ConstructionCode = Cld.ConstructionCode ");
2157
                sql.Append("    and Cbd.DetailNo = 2 ");
2158
                sql.Append("  inner join SubContractorMaster as Sc on Sc.COMPANYCODE = Cld.CompanyCode ");
2159
                sql.AppendFormat("  and Sc.LABOURKIND = {0} ", m_Labourkind);
2160
                sql.Append("  left join ConstructionLedgerExcute AS Cle on Cle.ConstructionCode = Cld.ConstructionCode ");
2161
                sql.Append("  and Cle.GroupCount = Cld.GroupCount ");
2162
                sql.Append("  and Cle.LineCount = Cld.LineCount ");
2163
                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);
2164
                sql.Append("  left join ( ");
2165
                sql.Append("  BillingData as Bd join ( ");
2166
                sql.Append("    BillingDataDetail as Bdd join SubContractorMaster as Scm ");
2167
                sql.Append("      on Bdd.CompanyCode = Scm.CompanyCode ");
2168
                sql.AppendFormat("      and Scm.LabourKind = {0} ", m_Labourkind);
... 差分の行数が表示可能な上限を超えました。超過分は表示しません。

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