Пример #1
0
    private GetTransactionsList_Result GetWSTransactionsList(string Status)
    {
        GetTransactionsList_Result obj = new GetTransactionsList_Result();

        string str;

        MagicWS_ForCounterService.MagicWS_ForCounterService wsobj = new MagicWS_ForCounterService.MagicWS_ForCounterService();
        wsobj.GetTransactionsList(Status, out obj.Result, out str);

        if (str == "")
        {
        }
        else
        {
            string[] v_split_text;
            char[]   delimeterChar = new char[] { '|' };
            v_split_text = str.Split(delimeterChar);

            int v_split_text_Length    = v_split_text.Length;
            TransactionsList[] listobj = new TransactionsList[v_split_text_Length];
            for (int i = 0; i < v_split_text_Length; i++)
            {
                listobj[i] = new TransactionsList();
                listobj[i] = GetDelimetedByColonToObject(v_split_text[i]);
            }

            obj.transactionsList = listobj;
        }

        return(obj);
    }
Пример #2
0
 public void PayOrBorrow(double amount)
 {
     Debt += amount;
     TransactionsList.Add(new Payment(DateTime.Now, amount));
     Notify("Debt");
     //Behøver ikke notify på TransactionsList da den er ObservableCollection
 }
Пример #3
0
        public PaginatedItemsResponse <UserCredits> GetTransactionsPaginated(PaginatedRequest model)
        {
            List <UserCredits> TransactionsList           = null;
            PaginatedItemsResponse <UserCredits> response = null;

            DataProvider.ExecuteCmd(GetConnection, "dbo.UserCredits_SelectAll"
                                    , inputParamMapper : delegate(SqlParameterCollection paramCollection)
            {
                paramCollection.AddWithValue("@CurrentPage", model.CurrentPage);
                paramCollection.AddWithValue("@ItemsPerPage", model.ItemsPerPage);
                paramCollection.AddWithValue("@Query", model.Query);
            }, map : delegate(IDataReader reader, short set)
            {
                if (set == 0)

                {
                    UserCredits data  = new UserCredits();
                    int startingIndex = 0;   //startingOrdinal

                    data.Id            = reader.GetSafeInt32(startingIndex++);
                    data.UserId        = reader.GetSafeString(startingIndex++);
                    data.Amount        = reader.GetSafeDecimal(startingIndex++);
                    data.TransactionId = reader.GetSafeInt32(startingIndex++);
                    data.JobId         = reader.GetSafeInt32(startingIndex++);
                    data.DateAdded     = reader.GetSafeDateTime(startingIndex++);

                    UserMini User = new UserMini();

                    User.FirstName = reader.GetSafeString(startingIndex++);
                    User.LastName  = reader.GetSafeString(startingIndex++);
                    User.Email     = reader.GetSafeString(startingIndex++);
                    User.Phone     = reader.GetSafeString(startingIndex++);
                    User.Url       = reader.GetSafeString(startingIndex++);

                    data.User = User;

                    if (TransactionsList == null)
                    {
                        TransactionsList = new List <UserCredits>();
                    }

                    TransactionsList.Add(data);
                }
                else if (set == 1)
                {
                    response = new PaginatedItemsResponse <UserCredits>();

                    response.TotalItems = reader.GetSafeInt32(0);
                }
            }

                                    );
            response.Items        = TransactionsList;
            response.CurrentPage  = model.CurrentPage;
            response.ItemsPerPage = model.ItemsPerPage;
            return(response);
        }
Пример #4
0
        public async Task <Result <TransactionsList> > GetTransactionsList(string accessToken)
        {
            await Task.Delay(1000);

            var fakeAccService = accountService as FakeAccountService;
            var transList      = new TransactionsList()
            {
                tokenList = transactions[fakeAccService.currentUser.Name]
            };

            return(new SuccessResult <TransactionsList>(transList));
        }
Пример #5
0
    protected void TypeFilter_Click(object sender, EventArgs e)
    {
        DescFlag = false;
        AmtFlag  = false;
        CatFlag  = false;
        DateFlag = false;

        transactions = DA.returnTransactionsCategorySort(Convert.ToInt64(Session["account"]), 4, TypeFlag);

        TypeFlag = !TypeFlag;

        TransactionsList.DataSource = transactions;
        TransactionsList.DataBind();
    }
Пример #6
0
        // Adiciona a transação à lista de transações.
        private Transactions AddTransactions(int TransactionNumber, TransactionTypeLock LockTransactions)
        {
            Transactions transaction = null;

            if (!TransactionsList.ContainsKey(TransactionNumber))
            {
                transaction = new Transactions(TransactionNumber, LockTransactions);
                TransactionsList.Add(TransactionNumber, transaction);
            }
            else
            {
                transaction = TransactionsList[TransactionNumber];
            }

            return(transaction);
        }
Пример #7
0
    public void searchTransactions(object sender, EventArgs e)
    {
        DataAbstract DA        = new DataAbstract();
        DateTime     d1        = new DateTime(2000, 1, 1);
        DateTime     d2        = new DateTime(2100, 12, 12);
        string       searchkey = Search.Text;

        if (searchkey != "" && searchkey != "Search")
        {
            transactions = DA.returnTransactionsSearch(Convert.ToInt64(Session["account"]), d1, d2, searchkey);
            TransactionsList.DataSource = transactions;
            TransactionsList.DataBind();
        }
        if (searchkey == "All" || searchkey == "all")
        {
            transactions = DA.returnTransactions(Convert.ToInt64(Session["account"]));
            TransactionsList.DataSource = transactions;
            TransactionsList.DataBind();
        }
    }
Пример #8
0
    protected void Page_PreRender()
    {
        if (!IsPostBack)
        {
            DataAbstract DA = new DataAbstract();
            if (Convert.ToInt32(Session["userID"]) != 0)
            {
                userID = Convert.ToInt32(Session["userID"]);
                DataSet accountData = DA.returnAccounts(userID);               //gets all accounts
                System.Data.DataTable accountsTable = accountData.Tables[0];   //table holding all account entries for the user
                object s = accountsTable.Rows[0].Field <object>("AcctNumber"); //sets the default account to the first of the user's accounts. LIKELY CHANGE LATER.
                if (Session["account"] == null)
                {
                    Session["account"] = Convert.ToInt64(s);                    //saves the first account as the default account during the session
                }
                userID = Convert.ToInt16(Session["userID"]);                    //saves the Session userID to the variable on this page
            }
            else
            {
                Session["userID"]  = 1; //temporary solution for demo 3/19/2017
                Session["account"] = 211111110;
            }
            // long, datetime, datetime int, int
            transactions = DA.returnTransactions(Convert.ToInt64(Session["account"]));
            TransactionsList.DataSource = transactions;
            TransactionsList.DataBind();
            int uid = Convert.ToInt32(Session["userID"]);
            ChangeCategoryDD.Items.Insert(0, new ListItem("Select Account", "0"));
            ChangeCategoryDD.DataSource     = DA.returnCategories(uid);
            ChangeCategoryDD.DataTextField  = "Name";
            ChangeCategoryDD.DataValueField = "CategoryID";
            ChangeCategoryDD.DataBind();

            ListItem LVI = ChangeCategoryDD.Items.FindByValue("6");     //set listview selected to 'other' on load
            if (LVI != null)
            {
                int index = ChangeCategoryDD.Items.IndexOf(LVI);
                ChangeCategoryDD.SelectedIndex = index;
            }
        }
    }
Пример #9
0
    // Common Method ใช้ภายใน
    private TransactionsList GetDelimetedByColonToObject(string str)
    {
        TransactionsList obj = new TransactionsList();

        string[] v_split_text;
        char[]   delimeterChar = new char[] { ':' };
        v_split_text      = str.Split(delimeterChar);
        obj.PIN           = v_split_text[0];
        obj.MobileNumber  = v_split_text[1];
        obj.ClientNumber  = v_split_text[2];
        obj.PolicyNumber  = v_split_text[3];
        obj.VoucherNumber = v_split_text[4];
        obj.ClaimNumber   = v_split_text[5];
        obj.ClaimDate     = v_split_text[6];
        obj.ClientName    = v_split_text[7];
        obj.Amount        = v_split_text[8];
        obj.Status        = v_split_text[9];
        obj.OTPExpiryDate = v_split_text[10];

        return(obj);
    }
Пример #10
0
        public async Task <List <TransactionsList> > ReadFileAsync(string filePath)
        {
            string[] data      = new string[] { };
            int      lineCount = 0;
            string   messages  = string.Empty;

            if (File.Exists(filePath))
            {
                using (StreamReader sr = new StreamReader(filePath, Encoding.UTF8))
                {
                    string line = await sr.ReadLineAsync();

                    Console.WriteLine("INFO: ============== Reading File ==============");
                    Console.WriteLine("INFO: Delimiter =  " + Settings.GetSettings.Delimiter);
                    List <TransactionsList> transactionsList = new List <TransactionsList>();
                    string[] lines = await File.ReadAllLinesAsync(filePath);

                    lineCount = lines.Count();
                    int index = 1;
                    while ((line = await sr.ReadLineAsync()) != null)
                    {
                        index++;

                        int percentage = TransactionsHelper.GetPercentage(index, lineCount);
                        ConsoleHelper.Write("INFO: Reading Line " + index + " of " + lineCount + " (" + percentage + "% completed)");

                        data = line.Split(Settings.GetSettings.Delimiter, StringSplitOptions.RemoveEmptyEntries);

                        if (data.Length >= 5)
                        {
                            TransactionEntity transactionEntity = new TransactionEntity();
                            DateTime          transactionDate   = new DateTime();

                            transactionEntity.TransactionDate        = data[0].Clean().ConvertStringToDate();
                            transactionEntity.TransactionType        = data[1].Clean();
                            transactionEntity.TransactionDescription = data[2].Clean();
                            transactionEntity.TransactionAmount      = data[3].ConvertToDecimal();
                            transactionEntity.TransactionBalance     = data[4].ConvertToDecimal();

                            if (transactionEntity.TransactionDate != DateTime.MinValue)
                            {
                                transactionDate = transactionEntity.TransactionDate;
                                string sheetName = transactionDate.ToString("MMM-yyyy");

                                TransactionsList findExisting = transactionsList.Find(t => t.Name == sheetName);

                                if (findExisting != null)
                                {
                                    findExisting.TransactionEntity.Add(transactionEntity);
                                }
                                else
                                {
                                    TransactionsList newMonthlyTransaction = new TransactionsList();
                                    newMonthlyTransaction.Name = sheetName;
                                    newMonthlyTransaction.Date = transactionDate;
                                    newMonthlyTransaction.TransactionEntity.Add(transactionEntity);

                                    transactionsList.Add(newMonthlyTransaction);
                                }
                            }
                            else
                            {
                                messages += "WARNING:Line " + index + " can't parse date and time\n";
                            }
                        }
                        else
                        {
                            messages += "WARNING:Line " + index + " skipped invalid or empty data";
                            if (index != lineCount)
                            {
                                messages += "\n";
                            }
                        }
                    }
                    Console.WriteLine();
                    Console.WriteLine(messages);
                    return(transactionsList);
                }
            }
            else
            {
                Console.WriteLine("FATAL ERROR: Can't find file " + filePath);
            }

            return(null);
        }
Пример #11
0
    private GetTransactionsList_Result GetWSTransactionsList(string Status)
    {
        GetTransactionsList_Result obj = new GetTransactionsList_Result();

        string str;

        MagicWS_ForCounterService.MagicWS_ForCounterService wsobj = new MagicWS_ForCounterService.MagicWS_ForCounterService();
        wsobj.GetTransactionsList(Status, out obj.Result, out str);

        if (str == "")
        {

        }
        else
        {
            string[] v_split_text;
            char[] delimeterChar = new char[] { '|' };
            v_split_text = str.Split(delimeterChar);

            int v_split_text_Length = v_split_text.Length;
            TransactionsList[] listobj = new TransactionsList[v_split_text_Length];
            for (int i = 0; i < v_split_text_Length; i++)
            {
                listobj[i] = new TransactionsList();
                listobj[i] = GetDelimetedByColonToObject(v_split_text[i]);
            }

            obj.transactionsList = listobj;
        }

        return obj;
    }
Пример #12
0
        static void Main(string[] args)
        {
            //Can't load 900000-600000 from 1 key -> buffer to small
            //Can't save 1300000 to 1 key -> ?

            //50 mb
            //Took 3531.25ms to store (300000 records in 1 key)
            //Took 2953.125ms to load (300000 records from 1 key)
            //Removed all keys from db
            //Took 17765.625ms to store (300000 records in list)
            //Took 3140.625ms to load (300000 records from list)
            ///************************************
            //Took 5265.625ms to store (500000 records in 1 key)
            //Took 4921.875ms to load (500000 records from 1 key)
            //Removed all keys from db
            //Took 29531.25ms to store (500000 records in list)
            //Took 5359.375ms to load (500000 records from list)

            //noute
            //Took 4243,2427ms to store (300000 records in 1 key)
            //Took 4480,2562ms to load (300000 records from 1 key)
            //Took 4448,2544ms to load (1 item from 1 key): test Description _Description_0
            //Removed all keys from db
            //Took 30159,725ms to store (300000 records in list)
            //Took 4279,2447ms to load (300000 records from list)
            //Took 22,0013ms to load (1 item from 1 key): test Description _Description_100
            //Removed all keys from db
            //************************
            //Testing Raven DB...

            //Took 14101,8066ms to store (30000 records in 1 key)
            //Took 10028,5736ms to load (30000 records from 1 key)

            //tst redis
            int totalRecords = 300000;
            //int totalRecords = 30000;
            var trans = new List<Transaction>();
            for (int i = 0; i < totalRecords; i++)
            {
                trans.Add(new Transaction() { Description = "test Description _Description_" + i, Id = i });
            }

            var before = DateTime.Now;

            //TimeSpan exp = new TimeSpan(0, 2400, 0);
            using (var redisClient = new RedisClient())
            {
                var typedRedis = redisClient.GetTypedClient<List<Transaction>>();
                typedRedis.SetEntry("test", trans);
            }
            Console.WriteLine("Took {0}ms to store ({1} records in 1 key)", (DateTime.Now - before).TotalMilliseconds, totalRecords);

            before = DateTime.Now;
            using (var redisClient = new RedisClient())
            {
                var typedRedis = redisClient.GetTypedClient<List<Transaction>>();
                trans = typedRedis["test"];
            }
            Console.WriteLine("Took {0}ms to load ({1} records from 1 key)", (DateTime.Now - before).TotalMilliseconds, trans.Count);

            before = DateTime.Now;
            using (var redisClient = new RedisClient())
            {
                var typedRedis = redisClient.GetTypedClient<List<Transaction>>();
                trans = typedRedis["test"];
            }
            Console.WriteLine("Took {0}ms to load (1 item from 1 key): {1}", (DateTime.Now - before).TotalMilliseconds, trans[0].Description);

            using (var redisClient = new RedisClient())
            {
                redisClient.FlushAll();
            }
            Console.WriteLine("Removed all keys from db");

            using (var redisClient = new RedisClient())
            {
                var typedRedis = redisClient.GetTypedClient<Transaction>();
                var currStat = typedRedis.Lists["test"];
                //trans.ForEach(x => currStat.Add(x));
                currStat.AddRange(trans);
            }
            Console.WriteLine("Took {0}ms to store ({1} records in list)", (DateTime.Now - before).TotalMilliseconds, totalRecords);

            before = DateTime.Now;
            using (var redisClient = new RedisClient())
            {
                var typedRedis = redisClient.GetTypedClient<Transaction>();
                var currStat = typedRedis.Lists["test"];
                trans = currStat.GetAll();
            }
            Console.WriteLine("Took {0}ms to load ({1} records from list)", (DateTime.Now - before).TotalMilliseconds, trans.Count);

            before = DateTime.Now;
            using (var redisClient = new RedisClient())
            {
                var typedRedis = redisClient.GetTypedClient<Transaction>();
                var currStat = typedRedis.Lists["test"];
                var tr = new Transaction() { Id = 100 };
                var res = currStat[currStat.IndexOf(tr)];
                Console.WriteLine("Took {0}ms to load (1 item from 1 key): {1}", (DateTime.Now - before).TotalMilliseconds, res.Description);
            }

            using (var redisClient = new RedisClient())
            {
                redisClient.FlushAll();
            }
            Console.WriteLine("Removed all keys from db");

            /*Console.WriteLine("trying to fill all memory");
            using (var redisClient = new RedisClient())
            {
                var typedRedis = redisClient.GetTypedClient<Transaction>();
                var currStat = typedRedis.Lists["test"];
                int i = 0;
                while (true)
                {
                    var tr = new Transaction() { Description = "test Description _Description_" + i, Id = i };
                    currStat.Add(tr);
                    i++;
                }
            }*/
            Console.ReadLine();
            return;

            //Raven DB

            Console.WriteLine("Testing Raven DB...");
            Console.WriteLine("");

            var rtrans = new TransactionsList();
            rtrans.Transactions = new List<Transaction>();
            for (int i = 0; i < totalRecords; i++)
            {
                rtrans.Transactions.Add(new Transaction() { Description = "test Description _Description_" + i, Id = i });
            }

            var store = new DocumentStore { Url = "http://localhost:8080" };
            store.Initialize();
            before = DateTime.Now;
            using (var session = store.OpenSession())
            {
                session.Store(rtrans, "trans");
                session.SaveChanges();
            }
            Console.WriteLine("Took {0}ms to store ({1} records in 1 key)", (DateTime.Now - before).TotalMilliseconds, totalRecords);

            before = DateTime.Now;
            using (var session = store.OpenSession())
            {
                var order = session.Load<TransactionsList>("trans");
                Console.WriteLine("Took {0}ms to load ({1} records from 1 key)", (DateTime.Now - before).TotalMilliseconds, order.Transactions.Count);
            }

            //Load of 300000:
            //simple-4900ms
            //list-4600ms

            //Save of 300000:
            //simple-3200ms
            //list-15300ms
            Console.ReadLine();
            return;
        }
Пример #13
0
 public ElementShadowTransition(ElementShadowPair current, TransactionsList transactionsList, ElementShadowPair next)
 {
     Current          = current;
     TransactionsList = transactionsList;
     Next             = next;
 }
Пример #14
0
 /// <summary>
 /// Add another transaction to the list of transactions.
 /// </summary>
 /// <param name="transactionsList"></param>
 public void Add(TransactionsList transactionsList)
 {
     _transactions.Push(transactionsList);
 }
Пример #15
0
    // Common Method ใช้ภายใน
    private TransactionsList GetDelimetedByColonToObject(string str)
    {
        TransactionsList obj = new TransactionsList();

        string[] v_split_text;
        char[] delimeterChar = new char[] { ':' };
        v_split_text = str.Split(delimeterChar);
        obj.PIN = v_split_text[0];
        obj.MobileNumber = v_split_text[1];
        obj.ClientNumber = v_split_text[2];
        obj.PolicyNumber = v_split_text[3];
        obj.VoucherNumber = v_split_text[4];
        obj.ClaimNumber = v_split_text[5];
        obj.ClaimDate = v_split_text[6];
        obj.ClientName = v_split_text[7];
        obj.Amount = v_split_text[8];
        obj.Status = v_split_text[9];
        obj.OTPExpiryDate = v_split_text[10];

        return obj;
    }
Пример #16
0
 protected override void ClearData()
 {
     TransactionsList.Clear();
 }
Пример #17
0
        public JsonResult SaveTrans(DateTime OrderDate, decimal CustomerUID, List <COItem> ItemList, List <COItemSchedule> ItemQtyList)
        {
            var r = Json(new { IsSaved = false, ErrMsg = "Not Saved" }, JsonRequestBehavior.AllowGet);

            r.MaxJsonLength = int.MaxValue;

            var db          = new DemoEntities();
            var ProductList = db.SP_CustomerwiseProductList(CustomerUID).ToList();

            var trSLNo   = db.TransactionSlNos.Where(x => x.BranchId == AppLib.BranchId && x.TableName == "Transactions").FirstOrDefault();
            var trlSLNo  = db.TransactionSlNos.Where(x => x.BranchId == AppLib.BranchId && x.TableName == "TransactionsList").FirstOrDefault();
            var trldSLNo = db.TransactionSlNos.Where(x => x.BranchId == AppLib.BranchId && x.TableName == "TransactionsListDely").FirstOrDefault();

            var docNo  = db.DocumentTypeMLists.Where(x => x.BranchId == AppLib.BranchId && x.Yr == AppLib.FinYear && x.DocumentTypeId == (int)AppLib.DocumdentType.CustomerOrder).FirstOrDefault();
            var status = db.StatusMs.Where(x => x.Status == "Open").FirstOrDefault();

            if (docNo == null)
            {
                docNo = new DocumentTypeMList()
                {
                    BranchId = AppLib.BranchId,
                    Yr       = AppLib.FinYear
                };
                db.DocumentTypeMLists.Add(docNo);
            }

            try
            {
                trSLNo.LastID       += 1;
                docNo.LastId        += 1;
                docNo.LastUpdateDate = DateTime.Now;
                Transaction tr = new Transaction()
                {
                    UID             = trSLNo.LastID,
                    BranchId        = AppLib.BranchId,
                    FinYear         = AppLib.FinYear,
                    DocumentTypeID  = (int)AppLib.DocumdentType.CustomerOrder,
                    DocumentNo      = docNo.LastId,
                    LongDocumentNo  = string.Format("CO{0}/{1:D4}", AppLib.FinYear % 100, docNo.LastId),
                    DocumentDate    = OrderDate,
                    PreparedDate    = OrderDate,
                    AccountM_UID    = CustomerUID,
                    RefDoc          = "",
                    AddlNotes       = "",
                    AddAmount       = 0,
                    PackingCharge   = 0,
                    Discount        = 0,
                    SpecialDiscount = 0,
                    ED                           = 0,
                    EDRoundOff                   = 0,
                    EDCess                       = 0,
                    OtherSalesTax                = 0,
                    LocalSalesTax                = 0,
                    Surcharge                    = 0,
                    ServiceTax                   = 0,
                    ServiceTaxCess               = 0,
                    OtherDiscount                = 0,
                    GrossValue                   = 0,
                    TotalValue                   = 0,
                    StatusM_UID                  = status.UID,
                    RefTransactions_UID          = 0,
                    TotalValueRoundOff           = 0,
                    AmendmentNo                  = 0,
                    AmendmentDate                = DateTime.Now,
                    PrintCount                   = 0,
                    AmendmentReason              = "",
                    DespatchToId                 = 0,
                    DealerId                     = 0,
                    RegionId                     = 0,
                    ZoneId                       = 0,
                    AreaId                       = 0,
                    InchargeId                   = 0,
                    StatutoryDocM_UID            = 0,
                    ViewType                     = 0,
                    CurrencyId                   = 0,
                    CurrencyConversionRate       = 0,
                    RefDocDate                   = DateTime.Now,
                    RefDoc1                      = "",
                    StatusReason                 = "",
                    HECess                       = 0,
                    ClosedGrossValue             = 0,
                    IsEDModified                 = false,
                    IsEDCessModified             = false,
                    IsLocalSalesTaxModified      = false,
                    IsTotalValueRoundOffModified = false,
                    IsHECessModified             = false,
                    TransactionsGate_UID         = 0,
                    ServiceTaxHECess             = 0
                };
                foreach (var item in ItemList)
                {
                    trlSLNo.LastID += 1;
                    var qty     = ItemQtyList.Where(x => x.ItemUID == item.UID).Sum(x => x.Qty);
                    var Product = ProductList.Where(x => x.UID == item.UID).FirstOrDefault();

                    decimal Price  = Product.Price.Value;
                    decimal Amount = Price * qty;

                    decimal DisPer = Product.DiscountPer;
                    decimal DisAmt = Amount * DisPer / 100;

                    decimal ItemAmount = Amount - DisAmt;

                    decimal CGSTPer = Product.CGSTPer ?? 0;
                    decimal CGSTAmt = ItemAmount * CGSTPer / 100;

                    decimal SGSTPer = Product.SGSTPer ?? 0;
                    decimal SGSTAmt = ItemAmount * SGSTPer / 100;

                    decimal IGSTPer = Product.IGSTPer ?? 0;
                    decimal IGSTAmt = ItemAmount * IGSTPer / 100;

                    decimal ToalAmount = ItemAmount + CGSTAmt + SGSTAmt + IGSTAmt;

                    TransactionsList trl = new TransactionsList()
                    {
                        UID                        = trlSLNo.LastID,
                        ItemsM_UID                 = item.UID,
                        Qty                        = qty,
                        Price                      = Product.Price.Value,
                        BasicValue                 = Amount,
                        AddPer                     = 0,
                        AddAmount                  = 0,
                        BasicDiscountPer           = DisPer,
                        BasicDiscountAmount        = DisAmt,
                        PackingPer                 = 0,
                        PackingAmount              = 0,
                        ExciseDutyPer              = CGSTPer,
                        ExciseDutyAmount           = CGSTAmt,
                        CessPer                    = 0,
                        CessAmount                 = 0,
                        LocalSalesTaxPer           = SGSTPer,
                        LocalSalesTaxAmount        = SGSTAmt,
                        SurchargePer               = 0,
                        SurchargeAmount            = 0,
                        OtherSalesTaxPer           = IGSTPer,
                        OtherSalesTaxAmount        = IGSTAmt,
                        ServiceTaxPer              = 0,
                        ServiceTaxAmount           = 0,
                        ServiceTaxCessPer          = 0,
                        ServiceTaxCessAmount       = 0,
                        TotalValue                 = ToalAmount,
                        SalesVolumeDiscount        = ItemAmount,
                        Commission                 = 0,
                        SpecialDiscount            = 0,
                        StatusM_UID                = status.UID,
                        AddlDetails                = "",
                        UOM_UID                    = Product.UOM_UID,
                        RefTransactionsList_UID    = 0,
                        BalanceQty                 = qty,
                        QtyDC                      = 0,
                        QtyReceived                = 0,
                        QtyRejected                = 0,
                        QtyReworked                = 0,
                        Weight                     = 0,
                        ExciseGroupM_UID           = 765,
                        ItemsM_Tolerance           = 0,
                        CategoryM_UID              = Product.Category_UID,
                        Sales_AccountM_UID         = Product.Sales_AccountM_UID,
                        Stock_AccountM_UID         = Product.Stock_AccountM_UID,
                        Consumption_AccountM_UID   = Product.Consumption_AccountM_UID,
                        WIP_AccountM_UID           = Product.WIP_AccountM_UID,
                        ConversionUOM_UID          = Product.ConversionUOM_UID,
                        ConversionUOM_Qty          = Product.ConversionUOM_Qty,
                        ConversionUOM_Rate         = Product.ConversionUOM_Rate,
                        BatchNo                    = "",
                        CommissionM_UID            = 0,
                        CommissionPer              = 0,
                        PartyMItemsMPrice_UID      = 0,
                        ParentTransactionsList_UID = 0,
                        RefDocumentTypeId          = 0,
                        IsEDIncluded               = false,
                        HECessPer                  = 0,
                        HECessAmount               = 0,
                        IsVATApplicable            = false,
                        IsEDApplicable             = false,
                        StockValue                 = 0,
                        EDID                       = 0,
                        CessID                     = 0,
                        HECessID                   = 0,
                        VATID                      = 0,
                        CSTID                      = 0,
                        BalanceRejectedQty         = 0,
                        VATCategoryID              = 0,
                        TransactionsListSent_UID   = 0,
                        InspectionUID              = 0,
                        ServiceTaxID               = 0,
                        IsRateCalForRecQty         = false,
                        IsAlternateBOM             = false,
                        GRN_AccountM_UID           = Product.GRN_AccountM_UID
                    };

                    foreach (var trld in ItemQtyList.Where(x => x.ItemUID == item.UID).ToList())
                    {
                        trldSLNo.LastID += 1;
                        trl.TransactionsListDelies.Add(new TransactionsListDely()
                        {
                            UID               = trldSLNo.LastID,
                            DeliveryDate      = trld.DeliveryDate,
                            BalanceJobCardQty = 0,
                            ProductionQty     = 0,
                            DespatchedQty     = 0,
                            OrderedQty        = trld.Qty,
                            ReceivedQty       = 0,
                            StatusM_UID       = status.UID,
                            PackingDate       = trld.ScheduledDate,
                        });
                    }

                    tr.TransactionsLists.Add(trl);
                }

                tr.Discount   = tr.TransactionsLists.Sum(x => x.BasicDiscountAmount);
                tr.TotalValue = tr.TransactionsLists.Sum(x => x.TotalValue);

                db.Transactions.Add(tr);
                db.SaveChanges();

                r = Json(new { IsSaved = true, UID = tr.UID, OrderNo = tr.LongDocumentNo, ErrMsg = "" }, JsonRequestBehavior.AllowGet);
            }
            catch (Exception ex)
            {
                AppLib.WriteLog(ex);
            }

            return(r);
        }