Esempio n. 1
1
 /// <summary>
 /// 메트릭스의 행번호를 재정의합니다.
 /// </summary>
 /// <param name="Matrix">Matrix Object</param>
 /// <param name="ColUID">Numbering ColUID</param>
 private void SetMatrixRowNumbering(SAPbouiCOM.Matrix Matrix, string ColUID)
 {
     for (int iLooper = 1; iLooper <= Matrix.VisualRowCount; iLooper++)
     {
         Matrix.SetCellWithoutValidation(iLooper, ColUID, iLooper.ToString());
     }
     Matrix.FlushToDataSource();
 }
Esempio n. 2
1
        private void SetSupplyAmtToMatrix(SAPbouiCOM.Form oForm, SAPbouiCOM.Matrix oMatrix, int pRow)
        {
            string strREADCD = FN.GetMatirxCellValue(ref oMatrix, "U_READCD", pRow);
            string strYYYYMM = FN.GetMatirxCellValue(ref oMatrix, "U_YYYYMM", pRow);
            string strMONCNT = FN.GetMatirxCellValue(ref oMatrix, "U_MONCNT", pRow);
            string strPAPERTP = FN.GetRecordsetValue(string.Format("SELECT TOP 1 U_PAPERTP FROM [@KIS_SO00301_HRD] WHERE Code = '{0}' ", strREADCD));

            if (!string.IsNullOrEmpty(strREADCD) && !string.IsNullOrEmpty(strYYYYMM) && !string.IsNullOrEmpty(strPAPERTP))
            {

                string strAMT = FN.GetRecordsetValue(string.Format(" SELECT U_AMT FROM dbo.KIS_FN_GET_REQUEST_HRD ('{0}', '{1}', '{2}') ", strPAPERTP, strYYYYMM, strREADCD));
                decimal dSuppAmt = 0;
                if (!string.IsNullOrEmpty(strAMT))
                {
                    dSuppAmt = Convert.ToDecimal(strAMT) * int.Parse(strMONCNT == "" ? "0" : strMONCNT);
                }
                oMatrix.SetCellWithoutValidation(pRow, "U_SUPAMT", dSuppAmt.ToString());
            }
            else
                oMatrix.SetCellWithoutValidation(pRow, "U_SUPAMT", "0");
        }
Esempio n. 3
0
        private void SetMonthCountToMatrix(SAPbouiCOM.Form oForm, SAPbouiCOM.Matrix oMatrix, int pRow)
        {
            string strFRDATE = FN.GetMatirxCellValue(ref oMatrix, "U_FRDATE", pRow);
            string strTODATE = FN.GetMatirxCellValue(ref oMatrix, "U_TODATE", pRow);

            if (!string.IsNullOrEmpty(strFRDATE) && !string.IsNullOrEmpty(strTODATE))
            {
                string strMONCNT = FN.GetRecordsetValue(string.Format("SELECT DATEDIFF(DD, '{0}', '{1}') / 29 ", strFRDATE, strTODATE));
                oMatrix.SetCellWithoutValidation(pRow, "U_MONCNT", strMONCNT);
            }

            SetSupplyAmtToMatrix(oForm, oMatrix, pRow);
        }
Esempio n. 4
0
        private void SetMatrixValidate(SAPbouiCOM.Form oForm, SAPbouiCOM.Matrix oMatrix, ItemEvent pVal)
        {
            StringBuilder sb = new StringBuilder();
            string strCode = string.Empty;

            string strCardCode = string.Empty;
            string strCardName = string.Empty;
            string strVatRegNo = string.Empty;
            string strVatGroup = string.Empty;
            string strPerson = string.Empty;
            string strEmail = string.Empty;
            try
            {
                oRS = (SAPbobsCOM.Recordset)B1Connections.diCompany.GetBusinessObject(BoObjectTypes.BoRecordset);


                if (pVal.ColUID == "U_READCD" || pVal.ColUID == "U_CENTCD")
                {
                    strCode = FN.GetMatirxCellValue(ref oMatrix, pVal.ColUID, pVal.Row);

                    if (string.IsNullOrEmpty(strCode))
                    {
                        if (pVal.ColUID == "U_READCD")
                            oMatrix.SetCellWithoutValidation(pVal.Row, "U_READNM", "");
                        else
                            oMatrix.SetCellWithoutValidation(pVal.Row, "U_CENTNM", "");

                        oMatrix.SetCellWithoutValidation(pVal.Row, "U_CARDCD", "");
                        oMatrix.SetCellWithoutValidation(pVal.Row, "U_CARDNM", "");
                        oMatrix.SetCellWithoutValidation(pVal.Row, "U_SAUPNO", "");
                        oMatrix.SetCellWithoutValidation(pVal.Row, "U_VATGRP", "");
                        oMatrix.SetCellWithoutValidation(pVal.Row, "U_PERSON", "");
                        oMatrix.SetCellWithoutValidation(pVal.Row, "U_EMAIL", "");
                    }
                    else
                    {
                        sb.AppendLine(" SELECT T1.CardCode                                                           ");
                        sb.AppendLine("      , T1.CardName                                                           ");
                        sb.AppendLine("      , T1.VATRegNum                                                          ");
                        sb.AppendLine("      , T1.ECVatGroup                                                         ");
                        sb.AppendLine("      , T1.CntctPrsn                                                          ");
                        sb.AppendLine("      , T1.E_Mail                                                             ");
                        if (pVal.ItemUID == "mtx1")
                            sb.AppendLine("   FROM [@KIS_SO0030M_HRD] T0 INNER JOIN OCRD T1 ON T0.U_CARDCD = T1.CardCode ");
                        else
                            sb.AppendLine("   FROM [@KIS_SO0040M_HRD] T0 INNER JOIN OCRD T1 ON T0.U_CARDCD = T1.CardCode ");
                        sb.AppendFormat("  WHERE T0.Code = '{0}'                                            ", strCode);

                        oRS.DoQuery(sb.ToString());
                        if (!oRS.EoF)
                        {
                            //string strNowDate = B1Connections.theAppl.Company.ServerDate;

                            string strNowDate = B1Connections.diCompany.GetCompanyDate().ToShortDateString();
                            strNowDate = FN.SetDateFormatToDB(strNowDate, FN.eDateType.n_YYYYMMDD);
                            oMatrix.SetCellWithoutValidation(pVal.Row, "U_WRITEDT", FN.SetDateFormatToDB(strNowDate, FN.eDateType.n_YYYYMMDD));


                            strCardCode = oRS.Fields.Item("CardCode").Value.ToString();
                            strCardName = oRS.Fields.Item("CardName").Value.ToString();
                            strVatRegNo = oRS.Fields.Item("VATRegNum").Value.ToString();
                            strVatGroup = "A0";
                            //strPerson = oRS.Fields.Item("CntctPrsn").Value.ToString();
                            //strEmail = oRS.Fields.Item("E_Mail").Value.ToString();

                            oMatrix.SetCellWithoutValidation(pVal.Row, "U_CARDCD", strCardCode);
                            oMatrix.SetCellWithoutValidation(pVal.Row, "U_CARDNM", strCardName);
                            oMatrix.SetCellWithoutValidation(pVal.Row, "U_SAUPNO", strVatRegNo);
                            oMatrix.SetCellWithoutValidation(pVal.Row, "U_VATGRP", strVatGroup);
                            //oMatrix.SetCellWithoutValidation(pVal.Row, "U_PERSON", strPerson);
                            //oMatrix.SetCellWithoutValidation(pVal.Row, "U_EMAIL", strEmail);
                        }
                    }
                }

                else if (pVal.ColUID == "U_FRDATE")
                {
                    string strDate = FN.GetMatirxCellValue(ref oMatrix, pVal.ColUID, pVal.Row);
                    strDate = DateTimeLibrary.FirstDayOfCurrentMonth(strDate);
                    oMatrix.SetCellWithoutValidation(pVal.Row, "U_FRDATE", FN.SetDateFormatToDB(strDate, FN.eDateType.n_YYYYMMDD));
                    SetMonthCountToMatrix(oForm, oMatrix, pVal.Row);
                }

                else if (pVal.ColUID == "U_TODATE")
                {
                    string strDate = FN.GetMatirxCellValue(ref oMatrix, pVal.ColUID, pVal.Row);
                    strDate = DateTimeLibrary.LastDayOfCurrentMonth(strDate);
                    oMatrix.SetCellWithoutValidation(pVal.Row, "U_TODATE", FN.SetDateFormatToDB(strDate, FN.eDateType.n_YYYYMMDD));
                    SetMonthCountToMatrix(oForm, oMatrix, pVal.Row);
                }
                else if (pVal.ColUID == "U_MONCNT")
                {
                    SetSupplyAmtToMatrix(oForm, oMatrix, pVal.Row);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }