示例#1
0
        public static string NewJournalID()
        {
            int count = SingleInteger(
                "SELECT COUNT(*) FROM Journal WHERE Source = 'SL'");
            bool   hasfound  = false;
            string JournalID = "";

            while (!hasfound)
            {
                count++;
                JournalID = "SL." + count.ToString().PadLeft(5, '0');

                if (Akun.SingleInteger("SELECT COUNT(JournalID) FROM Journal WHERE JournalID = '" + JournalID + "'") == 0)
                {
                    hasfound = true;
                }
            }

            return(JournalID);
        }
示例#2
0
        public static string NewCBID(string AccountID, int Plus)
        {
            int    count = 0;
            string num = "", CBID = "", sVoucher = "";

            if (Plus == 0)
            {
                count = SingleInteger(
                    "SELECT COUNT(*) FROM CB WHERE AccountID = '" + AccountID + "' AND Plus = " + Plus);
                num      = "W";
                sVoucher = "BK";
            }
            else
            {
                count = SingleInteger(
                    "SELECT COUNT(*) FROM CB WHERE AccountID = '" + AccountID + "' AND Plus = " + Plus);
                num      = "D";
                sVoucher = "BM";
            }

            bool hasfound = false;

            while (!hasfound)
            {
                count++;
//				CBID = "CB." + AccountID
//					+ "." + num + "." + count.ToString().PadLeft(5, '0');
                CBID = sVoucher + "." + AccountID
                       + "." + num + "." + count.ToString().PadLeft(5, '0');

                if (Akun.SingleInteger("SELECT COUNT(CBID) FROM CB WHERE CBID = '" + CBID + "'") == 0)
                {
                    hasfound = true;
                }
            }

            return(CBID);
        }