Beispiel #1
0
 public static Generals CreateGenerals()
 {
     if (instance == null)
     {
         lock (_lock)
         {
             if (instance == null)
             {
                 instance = new Generals();
             }
         }
     }
     return(instance);
 }
Beispiel #2
0
        public int TransferInvoiceToSellType(bool current)
        {
            int         ni = Current.Number;
            InvoiceType it = InvoiceType.sell;

            if (!current)
            {
                GenerateNewInvoiceNumber(InvoiceType.sell);
                it = InvoiceType.proforma;
                db.Query(string.Format(@"UPDATE {4}`invoice` SET `type` = '{0}',`InvoiceId`='{1}' WHERE `InvoiceId`='{2}' AND `type`='{3}'", InvoiceType.sell, ni, Current.Number, it, DBName));
                db.Query(string.Format(@"UPDATE {4}`invoicedetails` SET `type` = '{0}',`InvoiceNo`='{1}' WHERE `InvoiceNo`='{2}' AND `type`='{3}'", InvoiceType.sell, ni, Current.Number, it, DBName));
            }


            decimal customer = GetCustomer(InvoiceType.sell);
            decimal amount   = GetPrice(InvoiceType.sell);

            //////////// NT= New Transaction
            TransactionActivity.Transaction NT = new TransactionActivity.Transaction();

            ////////// TTO= Transaction Type Order
            TransactionActivity.TransactionType TTO = TransactionActivity.TransactionType.Order;

            ///////// TMT= Transaction Method Type
            TransactionActivity.TransactionMethod TMT = TransactionActivity.TransactionMethod.Order;

            //////// set transaction Price
            NT.Amount = amount;
            /////// personal id for this transaction
            NT.PersonalID = customer;

            NT.Method        = TMT;
            NT.Description   = "سفارش فاکتور شماره " + ni.ToString();
            NT.Time          = DateTime.Now.ToShortTimeString();
            NT.Date          = Generals.CreateGenerals().dateManager.GetCurrentPersianDate();
            NT.Type          = TTO;
            NT.RemainAccount = tl.RemainAccount(customer) + amount;
            byte DFF = Convert.ToByte(TransactionActivity.TransactionStatus.Bedehkar);

            NT.Status = DFF;
            //tl.NewTransaction(NT);



            tl.FillTransaction(NT, GetTransactionID(InvoiceType.sell));
            return(ni);
        }