Exemple #1
0
        void SetHeader()
        {
            var masterRecord = dgInvReservationReportGrid.masterRecord;

            Uniconta.DataModel.InvItem itemRec = null;
            string Item = null;

            var storage = masterRecord as Uniconta.DataModel.InvItemStorage;

            if (storage != null)
            {
                Item = storage._Item;
            }
            else
            {
                var invItem = masterRecord as Uniconta.DataModel.InvItem;
                if (invItem != null)
                {
                    Item = invItem._Item;
                }
            }

            if (Item != null)
            {
                var cache = api.CompanyEntity.GetCache(typeof(Uniconta.DataModel.InvItem));
                if (cache != null)
                {
                    itemRec = (Uniconta.DataModel.InvItem)cache.Get(Item);
                }
                else
                {
                    api.CompanyEntity.LoadCache(typeof(Uniconta.DataModel.InvItem), api);
                    itemRec = null;
                }
            }

            if (itemRec != null && itemRec != lastItem)
            {
                lastItem = itemRec;
                string header = string.Format("{0}; {1}, {2}", Uniconta.ClientTools.Localization.lookup("Reservations"), itemRec._Item, itemRec._Name);
                SetHeader(header);
            }
        }
Exemple #2
0
        void SetHeader()
        {
            var masterRecord = dgInvItemStorageClientGrid.masterRecord;

            Uniconta.DataModel.InvItem itemRec = null;
            string Item = null;

            var storage = masterRecord as Uniconta.DataModel.InvItemStorage;

            if (storage != null)
            {
                Item = storage._Item;
            }
            else
            {
                var orderline = masterRecord as Uniconta.DataModel.DCOrderLine;
                if (orderline != null)
                {
                    Item = orderline._Item;
                }
                else
                {
                    var jourline = masterRecord as Uniconta.DataModel.InvJournalLine;
                    if (jourline != null)
                    {
                        Item = jourline._Item;
                    }
                    else
                    {
                        var invtran = masterRecord as Uniconta.DataModel.InvTrans;
                        if (invtran != null)
                        {
                            Item = invtran._Item;
                        }
                        else
                        {
                            var invBom = masterRecord as Uniconta.DataModel.InvBOM;
                            if (invBom != null)
                            {
                                Item = invBom._ItemPart;
                            }
                            else
                            {
                                var invSerieBatch = masterRecord as Uniconta.DataModel.InvSerieBatch;
                                if (invSerieBatch != null)
                                {
                                    Item = invSerieBatch._Item;
                                }
                                else
                                {
                                    itemRec = masterRecord as Uniconta.DataModel.InvItem;
                                }
                            }
                        }
                    }
                }
            }

            if (Item != null)
            {
                var cache = api.GetCache(typeof(Uniconta.DataModel.InvItem));
                if (cache != null)
                {
                    itemRec = (Uniconta.DataModel.InvItem)cache.Get(Item);
                }
                else
                {
                    api.LoadCache(typeof(Uniconta.DataModel.InvItem));
                    itemRec = null;
                }
            }

            if (itemRec != null && itemRec != lastItem)
            {
                lastItem = itemRec;
                string header = string.Format("{0}: {1}, {2}", Uniconta.ClientTools.Localization.lookup("Storage"), itemRec._Item, itemRec._Name);
                SetHeader(header);

                // here we could set number of decimals. itemRec._Decimals
            }
        }