Esempio n. 1
0
        public static string GetFacturNo(EnumTransactionStatus transactionStatus, bool automatedIncrease)
        {
            TReference refer = GetReference((EnumReferenceType)Enum.Parse(typeof(EnumReferenceType), transactionStatus.ToString()));
            decimal    no    = Convert.ToDecimal(refer.ReferenceValue) + 1;

            //reset factur no to 1 every month
            //if (DateTime.Today.Day == 1 && refer.ModifiedDate < DateTime.Today)
            if (refer.ModifiedDate < DateTime.Today)
            {
                no = 1;
            }

            refer.ReferenceValue = no.ToString();
            if (automatedIncrease)
            {
                ITReferenceRepository referenceRepository = new TReferenceRepository();
                refer.ModifiedDate = DateTime.Now;
                referenceRepository.Update(refer);
                referenceRepository.DbContext.CommitChanges();
            }

            string tipeTrans = string.Empty;

            char[] charTransArray = transactionStatus.ToString().ToCharArray();
            char   charTrans;

            for (int i = 0; i < transactionStatus.ToString().Length; i++)
            {
                charTrans = charTransArray[i];
                if (char.IsUpper(transactionStatus.ToString(), i))
                {
                    tipeTrans += transactionStatus.ToString().Substring(i, 1);
                }
            }

            StringBuilder result = new StringBuilder();

            result.Append(CONST_FACTURFORMAT);
            result.Replace("[TRANS]", tipeTrans);
            result.Replace("[XXX]", GetFactur(5, no));
            result.Replace("[DAY]", DateTime.Today.Day.ToString());
            result.Replace("[MONTH]", DateTime.Today.ToString("MMM").ToUpper());
            result.Replace("[YEAR]", DateTime.Today.Year.ToString());
            return(result.ToString());
        }
Esempio n. 2
0
        public static string GetReceiptNo(bool automatedIncrease)
        {
            TReference refer = GetReference(EnumReferenceType.InstallmentReceiptNo);
            decimal    no    = Convert.ToDecimal(refer.ReferenceValue) + 1;

            refer.ReferenceValue = no.ToString();
            if (automatedIncrease)
            {
                ITReferenceRepository referenceRepository = new TReferenceRepository();
                referenceRepository.DbContext.BeginTransaction();
                referenceRepository.Update(refer);
                referenceRepository.DbContext.CommitTransaction();
            }

            string        formatFactur = "WMTI/[XXX]";
            StringBuilder result       = new StringBuilder();

            result.Append(formatFactur);
            result.Replace("[XXX]", GetFactur(5, no));
            return(result.ToString());
        }
Esempio n. 3
0
        public static string GetVoucherNo(bool automatedIncrease)
        {
            TReference refer = GetReference(EnumReferenceType.VoucherNo);
            decimal    no    = Convert.ToDecimal(refer.ReferenceValue) + 1;

            refer.ReferenceValue = no.ToString();
            if (automatedIncrease)
            {
                ITReferenceRepository referenceRepository = new TReferenceRepository();
                referenceRepository.DbContext.BeginTransaction();
                referenceRepository.Update(refer);
                referenceRepository.DbContext.CommitTransaction();
            }

            StringBuilder result = new StringBuilder();

            result.Append(CONST_VOUCHERNO);
            result.Replace("[XXX]", GetFactur(5, no));
            result.Replace("[DAY]", DateTime.Today.Day.ToString());
            result.Replace("[MONTH]", DateTime.Today.ToString("MMM").ToUpper());
            result.Replace("[YEAR]", DateTime.Today.Year.ToString());
            return(result.ToString());
        }
Esempio n. 4
0
        public static string GetFacturNo(EnumTransactionStatus transactionStatus, bool automatedIncrease)
        {
            TReference refer = GetReference((EnumReferenceType)Enum.Parse(typeof(EnumReferenceType), transactionStatus.ToString()));
            decimal    no    = Convert.ToDecimal(refer.ReferenceValue) + 1;

            refer.ReferenceValue = no.ToString();
            if (automatedIncrease)
            {
                ITReferenceRepository referenceRepository = new TReferenceRepository();
                referenceRepository.Update(refer);
                referenceRepository.DbContext.CommitChanges();
            }

            string tipeTrans = string.Empty;

            char[] charTransArray = transactionStatus.ToString().ToCharArray();
            char   charTrans;

            for (int i = 0; i < transactionStatus.ToString().Length; i++)
            {
                charTrans = charTransArray[i];
                if (char.IsUpper(transactionStatus.ToString(), i))
                {
                    tipeTrans += transactionStatus.ToString().Substring(i, 1);
                }
            }
            string        formatFactur = "GRAHA/[TRANS]/[XXX]/[MONTH]/[YEAR]";
            StringBuilder result       = new StringBuilder();

            result.Append(formatFactur);
            result.Replace("[TRANS]", tipeTrans);
            result.Replace("[XXX]", GetFactur(5, no));
            result.Replace("[MONTH]", DateTime.Today.ToString("MMM").ToUpper());
            result.Replace("[YEAR]", DateTime.Now.Year.ToString());
            return(result.ToString());
        }
Esempio n. 5
0
        public static string GetVoucherNo(bool automatedIncrease, EnumJournalType journalType)
        {
            TReference refer = GetReference(EnumReferenceType.VoucherNo);
            decimal    no    = Convert.ToDecimal(refer.ReferenceValue) + 1;

            refer.ReferenceValue = no.ToString();
            if (automatedIncrease)
            {
                ITReferenceRepository referenceRepository = new TReferenceRepository();
                referenceRepository.DbContext.BeginTransaction();
                referenceRepository.Update(refer);
                referenceRepository.DbContext.CommitTransaction();
            }

            string        formatFactur = "GRAHA/[TYPE]/[XXX]/[MONTH]/[YEAR]";
            StringBuilder result       = new StringBuilder();

            result.Append(formatFactur);
            result.Replace("[TYPE]", GetStringValue(journalType));
            result.Replace("[XXX]", GetFactur(5, no));
            result.Replace("[MONTH]", DateTime.Today.ToString("MMM").ToUpper());
            result.Replace("[YEAR]", DateTime.Now.Year.ToString());
            return(result.ToString());
        }