public string GetItemTotal(int?GroupId, int StoreId)
        {
            string  TotalValue  = "-99";
            decimal?_valueInv   = 0;
            decimal?_valueTrans = 0;
            IEnumerable <I_InventoryItemMaster> MappedItem;

            MappedItem = (from n in db.I_InventoryItemMaster where (n.MinorItemId == (GroupId)) select n).AsEnumerable();
            if (MappedItem != null && MappedItem.GetEnumerator().MoveNext())
            {
                _valueInv = (from s in db.I_StockInventory join m in MappedItem on s.ItemId equals m.ItemCode where s.StoreId == StoreId select s.Qty * s.TotalAmount).Sum();

                _valueTrans = (from st in db.I_StockTranferDetails
                               join stItem in db.I_StockTransferItemCatalog on st.Id equals stItem.ReqNo
                               join m in MappedItem on stItem.ItemCode equals m.ItemCode
                               where st.SourceStore == StoreId

                               select stItem.Qty * (db.I_StockInventory.Where(x => x.ItemId == stItem.ItemCode).Average(i => i.Price)) * -1
                               ).Sum();
                TotalValue = Convert.ToString((_valueInv == null ? 0 : _valueInv) + (_valueTrans == null ? 0 : _valueTrans));
            }



            return(TotalValue);
        }
示例#2
0
 private TreeViewItem CreateTreeViewItem(MappedItem newMappedItem)
 {
     return(new TreeViewItem()
     {
         Header = newMappedItem.Name,
         Tag = newMappedItem.Id.ToString()
     });
 }
示例#3
0
        private void TreeViewItemSelected(TreeViewItem selectedTreeViewItem)
        {
            _SelectedTreeViewItem = selectedTreeViewItem;
            _SelectedMappedItem   = DocumentMapping.Current.MappedItemDictionary[_SelectedTreeViewItem.Tag.ToString()];

            MappedItemNotesTex.Text = _SelectedMappedItem.Notes;

            var sp = (StackPanel)_SelectedTreeViewItem.Header;

            sp.Children[1].Visibility     = Visibility.Visible;
            EditMappedItemsBtn.Visibility = Visibility.Visible;
        }
示例#4
0
        private void TreeViewItemChanged <T>(object sender, RoutedPropertyChangedEventArgs <T> e)
        {
            var treeView = (TreeView)sender;

            _selectedTreeView        = (TreeViewItem)treeView.SelectedItem;
            _selectedMappedItem      = _selectedTreeView.Tag != null ? DocumentMapping.Current.MappedItemDictionary[_selectedTreeView.Tag.ToString()] : null;
            ParentNodesLabel.Content = _selectedMappedItem != null ? _selectedMappedItem.Name : _parentRootLavel;

            if (_selectedMappedItem != null)
            {
                ItemMapNotesText.Document.Blocks.Add(new Paragraph(new Run(_selectedMappedItem.Notes)));
            }
        }
示例#5
0
        private static void CreateMapedItemRangeControl(MappedItem mappedItem)
        {
            try
            {
                var range = Globals.ThisAddIn.Application.ActiveDocument.Range(0, 0);

                var vstoDocument = Globals.Factory.GetVstoObject(Globals.ThisAddIn.Application.ActiveDocument);
                range.Text = mappedItem.Name;
                var bookmark = vstoDocument.Bookmarks.Add(mappedItem.Id.ToString(), range);
            }
            catch (Exception)
            {
            }
        }
示例#6
0
 public List <MappedItem> GetMMFData()
 {
     using (var accessor = _mmfHelper.MMF.CreateViewAccessor())
     {
         //	Get size
         var size = accessor.ReadUInt32(ContentOffset);
         //	Read bytes
         var bytes = new byte[size];
         accessor.ReadArray(ContentOffset + sizeof(uint), bytes, 0, bytes.Length);
         //	Parse data
         return(Encoding.UTF8.GetString(bytes).Split(new[] { MapDelimiter }, StringSplitOptions.None).Skip(1)
                .Select(t => MappedItem.FromXElement(XElement.Parse(t)))
                .ToList());
     }
 }
示例#7
0
 private void ChangeSelectedTreeViewItem(TreeViewItem treeViewItem)
 {
     _selectedTreeView        = treeViewItem;
     ParentNodesLabel.Content = _selectedTreeView.Header.ToString();
     if (_selectedTreeView.Tag != null)
     {
         _selectedMappedItem           = DocumentMapping.Current.MappedItemDictionary[_selectedTreeView.Tag.ToString()];
         MappedItemText.Text           = _selectedMappedItem.Name;
         AddMappedItemtn.Visibility    = Visibility.Hidden;
         UpdateMappedItemtn.Visibility = Visibility.Visible;
     }
     else
     {
         AddMappedItemtn.Visibility    = Visibility.Visible;
         UpdateMappedItemtn.Visibility = Visibility.Hidden;
     }
 }
        public static MappedItem AddMappedItem(string itemname, MappedItem parentMappedItem = null)
        {
            MappedItem mappedItem = default(MappedItem);

            var caption = "Add to document map";

            itemname = itemname.Trim();
            if (itemname.Length == 0)
            {
                MessageBox.Show("Cant add spaces to document map", caption, MessageBoxButton.OK);
                itemname = string.Empty;
            }

            if (itemname.Length < 3)
            {
                var message = new StringBuilder("Are you sure you want to add,");
                message.AppendLine(itemname);
                if (MessageBox.Show(message.ToString(), caption, MessageBoxButton.YesNo) != MessageBoxResult.Yes)
                {
                    itemname = string.Empty;
                }
            }

            if (!string.IsNullOrEmpty(itemname))
            {
                try
                {
                    if (parentMappedItem == null)
                    {
                        mappedItem = new MappedItem(itemname, DocumentMapping.Current);
                    }
                    else
                    {
                        mappedItem = new MappedItem(itemname, DocumentMapping.Current, parentMappedItem);
                    }

                    DocumentMapping.Current.AddMappedItem(mappedItem);
                }
                catch (Exception ex)
                {
                }
            }

            return(mappedItem);
        }
示例#9
0
        private static void CreateMapedItemTextControl(MappedItem mappedItem)
        {
            try
            {
                var selectedText = Globals.ThisAddIn.Application.Selection;
                selectedText.InsertBefore($"{mappedItem.Name} ");
                Microsoft.Office.Tools.Word.PlainTextContentControl textControl;

                var vstoDocument = Globals.Factory.GetVstoObject(Globals.ThisAddIn.Application.ActiveDocument);
                textControl              = vstoDocument.Controls.AddPlainTextContentControl(mappedItem.Name);
                textControl.Text         = mappedItem.Name;
                textControl.LockContents = true;
                textControl.Title        = string.Empty;
                textControl.Tag          = mappedItem.Id.ToString();
            }
            catch (Exception ex)
            {
            }
        }
        private static void GetUsedPicklistInEntity(Guid tenantId, List <Entities.EntityCore.Model.PickListItem.PicklistObject> simpleNonCustomizable, List <FieldModel> fields, List <MappedItem> val)
        {
            IPicklistManager iPicklistManager = new PicklistManager();

            foreach (var field in fields)
            {
                var matchingField = simpleNonCustomizable.FirstOrDefault(t => t.Name.ToLower().Equals(field.TypeOf.ToLower()));
                if (matchingField != null)
                {
                    var values = iPicklistManager.GetPicklistValues(tenantId, matchingField.Name, null);
                    if (values != null && values.Rows.Count > 0)
                    {
                        var mappedItem = new MappedItem();
                        mappedItem.Name   = field.Name;
                        mappedItem.TypeOf = field.TypeOf;
                        mappedItem.Result = values;
                        val.Add(mappedItem);
                    }
                }
            }
        }
示例#11
0
        private void AddMappedItemtn_Click(object sender, RoutedEventArgs e)
        {
            var newMappedItem = new MappedItem()
            {
                Name  = MappedItemText.Text,
                Notes = new TextRange(ItemMapNotesText.Document.ContentStart, ItemMapNotesText.Document.ContentEnd).Text
            };

            if (_selectedTreeView == null || _selectedTreeView.Header.ToString() == _parentRootLavel)
            {
                MappedItemTreeView.Items.Add(CreateTreeViewItem(newMappedItem));
            }
            else
            {
                newMappedItem.ParentMappedItemId = _selectedMappedItem.Id;
                _selectedTreeView.Items.Add(CreateTreeViewItem(newMappedItem));
            }

            DocumentMapping.Current.AddMappedItem(newMappedItem);
            ChangeSelectedTreeViewItem(_selectedTreeView);
        }
        private void AddUpdateItem()
        {
            if (!string.IsNullOrEmpty(MappedItemText.Text))
            {
                MappedItem newMappedItem = null;
                if (_selectedMappedItem == null)
                {
                    newMappedItem = new MappedItem(MappedItemText.Text, DocumentMapping.Current);
                }
                else
                {
                    newMappedItem = new MappedItem(MappedItemText.Text, DocumentMapping.Current, _selectedMappedItem);
                }

                newMappedItem.Notes = new TextRange(ItemMapNotesText.Document.ContentStart, ItemMapNotesText.Document.ContentEnd).Text;

                DocumentMapping.Current.AddMappedItem(newMappedItem);

                Utils.SaveDocumentMap(DocumentMapping.Current);

                PopulateTreeView().Await();
            }
        }