Пример #1
0
        void ListView_Click(object sender, AdapterView.ItemClickEventArgs e)
        {
            ItemStock itm    = adapter[e.Position];         // listData.ElementAt (e.Position);
            var       intent = new Intent(this, typeof(StockEntry));

            intent.PutExtra("icode", itm.ICode);
            intent.PutExtra("trxdate", itm.DateTrx.ToString("dd-MM-yyyy"));
            StartActivity(intent);
        }
Пример #2
0
        private void SetViewDelegate(View view, object clsobj)
        {
            ItemStock item = (ItemStock)clsobj;

            view.FindViewById <TextView> (Resource.Id.date).Text      = item.DateTrx.ToString("dd-MM-yyyy");
            view.FindViewById <TextView> (Resource.Id.icodedesc).Text = item.IDesc;
            view.FindViewById <TextView> (Resource.Id.icode).Text     = item.ICode;
            view.FindViewById <TextView> (Resource.Id.qtyrec).Text    = item.QtyGR.ToString();
            view.FindViewById <TextView> (Resource.Id.qtyactual).Text = item.QtyAct.ToString();
            view.FindViewById <TextView> (Resource.Id.qtysales).Text  = item.QtySales.ToString();
            view.FindViewById <TextView> (Resource.Id.qtybrf).Text    = item.QtyBrf.ToString();
            view.FindViewById <TextView> (Resource.Id.qtyrtn).Text    = item.QtyRtr.ToString();
            view.FindViewById <TextView> (Resource.Id.qtycrf).Text    = item.QtyCrf.ToString();
        }
Пример #3
0
        private void InsertItemGRIntoDb(List<ItemGR> list)
        {
            string pathToDatabase = ((GlobalvarsApp)CallingActivity.Application).DATABASE_PATH;
            string userid = ((GlobalvarsApp)CallingActivity.Application).USERID_CODE;
            DateTime today = new DateTime(DateTime.Today.Year,DateTime.Today.Month,DateTime.Today.Day,00,00,00);
            DateTime tempdate = today.AddDays (-4);
            using (var db = new SQLite.SQLiteConnection (pathToDatabase)) {
                //var list2 = db.Table<Item>().ToList<Item>();
                var itemcode= db.Table<Item>().ToList();
                var stock= db.Table<ItemStock>().Where(x=>x.DateTrx>tempdate).OrderByDescending(x=>x.DateTrx).ToList();

                string desc = "";
                foreach (ItemGR item in list) {
                    desc = "";
                    var founditm = itemcode.Where (x => x.ICode == item.ICode).ToList ();
                    if (founditm.Count > 0)
                        desc = founditm [0].IDesc.Trim();

                    var found = stock.Where (x => x.ICode == item.ICode && x.DateTrx == item.TrxDate).ToList ();
                    if (found.Count > 0) {
                        found [0].QtyGR = item.Qty;
                        found [0].IDesc = desc;
                        db.Update (found[0]);
                    } else {
                        ItemStock itm = new ItemStock ();
                        itm.ICode = item.ICode;
                        itm.IDesc = desc;
                        itm.DateTrx = item.TrxDate;
                        itm.QtyGR = item.Qty;
                        itm.QtyAct = 0;
                        itm.QtyBrf = 0;
                        itm.QtyCrf = 0;
                        itm.QtyRtr = 0;
                        itm.QtySales = 0;
                        itm.StdUom = item.UOM;
                        itm.Wh = item.WH;
                        db.Insert (itm);
                    }
                }

                for ( int i=0;i<3;i++)
                {
                    int nday = i * -1;
                    tempdate =today.AddDays (nday);
                    var stock2= db.Table<ItemStock>().Where(x=>x.DateTrx==tempdate).ToList();
                    foreach (var itmc in itemcode) {
                        var found =stock2.Where(x=>x.DateTrx==tempdate&&x.ICode==itmc.ICode).ToList();
                        if (found.Count == 0) {
                            ItemStock itm = new ItemStock ();
                            itm.ICode = itmc.ICode;
                            itm.IDesc = itmc.IDesc;
                            itm.DateTrx = tempdate;
                            itm.QtyGR = 0;
                            itm.QtyAct = 0;
                            itm.QtyBrf = 0;
                            itm.QtyCrf = 0;
                            itm.QtyRtr = 0;
                            itm.QtySales = 0;
                            itm.StdUom = itmc.StdUom;
                            itm.Wh = userid;
                            db.Insert (itm);
                        }
                    }

                }

            }

            string dmsg = CallingActivity.Resources.GetString (Resource.String.msg_successdownitems);
            dmsg = dmsg.Replace ("nn", list.Count.ToString ());
            Downloadhandle.Invoke(CallingActivity,list.Count,dmsg);
        }
Пример #4
0
        private void InsertItemGRIntoDb(List <ItemGR> list)
        {
            string   pathToDatabase = ((GlobalvarsApp)CallingActivity.Application).DATABASE_PATH;
            string   userid         = ((GlobalvarsApp)CallingActivity.Application).USERID_CODE;
            DateTime today          = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 00, 00, 00);
            DateTime tempdate       = today.AddDays(-4);

            using (var db = new SQLite.SQLiteConnection(pathToDatabase)) {
                //var list2 = db.Table<Item>().ToList<Item>();
                var itemcode = db.Table <Item>().ToList();
                var stock    = db.Table <ItemStock>().Where(x => x.DateTrx > tempdate).OrderByDescending(x => x.DateTrx).ToList();

                string desc = "";
                foreach (ItemGR item in list)
                {
                    desc = "";
                    var founditm = itemcode.Where(x => x.ICode == item.ICode).ToList();
                    if (founditm.Count > 0)
                    {
                        desc = founditm [0].IDesc.Trim();
                    }

                    var found = stock.Where(x => x.ICode == item.ICode && x.DateTrx == item.TrxDate).ToList();
                    if (found.Count > 0)
                    {
                        found [0].QtyGR = item.Qty;
                        found [0].IDesc = desc;
                        db.Update(found[0]);
                    }
                    else
                    {
                        ItemStock itm = new ItemStock();
                        itm.ICode    = item.ICode;
                        itm.IDesc    = desc;
                        itm.DateTrx  = item.TrxDate;
                        itm.QtyGR    = item.Qty;
                        itm.QtyAct   = 0;
                        itm.QtyBrf   = 0;
                        itm.QtyCrf   = 0;
                        itm.QtyRtr   = 0;
                        itm.QtySales = 0;
                        itm.StdUom   = item.UOM;
                        itm.Wh       = item.WH;
                        db.Insert(itm);
                    }
                }

                for (int i = 0; i < 3; i++)
                {
                    int nday = i * -1;
                    tempdate = today.AddDays(nday);
                    var stock2 = db.Table <ItemStock>().Where(x => x.DateTrx == tempdate).ToList();
                    foreach (var itmc in itemcode)
                    {
                        var found = stock2.Where(x => x.DateTrx == tempdate && x.ICode == itmc.ICode).ToList();
                        if (found.Count == 0)
                        {
                            ItemStock itm = new ItemStock();
                            itm.ICode    = itmc.ICode;
                            itm.IDesc    = itmc.IDesc;
                            itm.DateTrx  = tempdate;
                            itm.QtyGR    = 0;
                            itm.QtyAct   = 0;
                            itm.QtyBrf   = 0;
                            itm.QtyCrf   = 0;
                            itm.QtyRtr   = 0;
                            itm.QtySales = 0;
                            itm.StdUom   = itmc.StdUom;
                            itm.Wh       = userid;
                            db.Insert(itm);
                        }
                    }
                }
            }

            string dmsg = CallingActivity.Resources.GetString(Resource.String.msg_successdownitems);

            dmsg = dmsg.Replace("nn", list.Count.ToString());
            Downloadhandle.Invoke(CallingActivity, list.Count, dmsg);
        }