Ejemplo n.º 1
0
        public ARBatchEntry()
        {
            CASetup caSetup = CASetup.Current;
            ARSetup arSetup = ARSetup.Current;

            RowUpdated.AddHandler <CABatch>(ParentFieldUpdated);
        }
 public DiscrepancyEnqGraphBase()
 {
     Rows.Cache.AllowDelete = false;
     Rows.Cache.AllowInsert = false;
     Rows.Cache.AllowUpdate = false;
     RowUpdated.AddHandler(typeof(TEnqFilter), FilterRowUpdated);
     FieldUpdated.AddHandler(typeof(TEnqFilter), typeof(DiscrepancyEnqFilter.periodFrom).Name, PeriodFromFieldUpdated);
     FieldUpdated.AddHandler(typeof(TEnqFilter), typeof(DiscrepancyEnqFilter.periodTo).Name, PeriodToFieldUpdated);
 }
Ejemplo n.º 3
0
        public CABatchEntry()
        {
            CASetup setup = casetup.Current;

            RowUpdated.AddHandler <CABatch>(ParentFieldUpdated);
            this.APPaymentApplications.Cache.AllowInsert = false;
            this.APPaymentApplications.Cache.AllowUpdate = false;
            this.APPaymentApplications.Cache.AllowDelete = false;
        }
        public ARBatchEntry()
        {
            CASetup setup = casetup.Current;

            RowUpdated.AddHandler <CABatch>(ParentFieldUpdated);
        }
Ejemplo n.º 5
0
        private void UpdateFreeItemLines(CRServiceCase current)
        {
            var groupedByInventory = new Dictionary <int, decimal>();

            foreach (CRServiceCaseDiscountDetail item in
                     PXSelect <CRServiceCaseDiscountDetail,
                               Where <CRServiceCaseDiscountDetail.serviceCaseID, Equal <Required <CRServiceCaseDiscountDetail.serviceCaseID> > > > .
                     Select(this, current.ServiceCaseID))
            {
                if (item.FreeItemID != null)
                {
                    var val = item.FreeItemQty ?? 0;
                    if (groupedByInventory.ContainsKey(item.FreeItemID.Value))
                    {
                        groupedByInventory[item.FreeItemID.Value] += val;
                    }
                    else
                    {
                        groupedByInventory.Add(item.FreeItemID.Value, val);
                    }
                }
            }

            bool freeItemChanged = false;

            RowDeleted.RemoveHandler(typeof(CRServiceCaseItem), CRServiceCaseItem_RowDeleted);
            RowInserted.RemoveHandler(typeof(CRServiceCaseItem), CRServiceCaseItem_RowInserted);
            RowUpdated.RemoveHandler(typeof(CRServiceCaseItem), CRServiceCaseItem_RowUpdated);
            try
            {
                foreach (CRServiceCaseItem line in FreeItems.Select())
                {
                    if (line.ManualDiscount == false && line.InventoryID != null)
                    {
                        if (groupedByInventory.ContainsKey(line.InventoryID.Value))
                        {
                            if (groupedByInventory[line.InventoryID.Value] == 0)
                            {
                                FreeItems.Delete(line);
                                freeItemChanged = true;
                            }
                        }
                        else
                        {
                            FreeItems.Delete(line);
                            freeItemChanged = true;
                        }
                    }
                }

                int?defaultWarehouse = GetDefaultWarehouse();
                foreach (KeyValuePair <int, decimal> kv in groupedByInventory)
                {
                    CRServiceCaseItem freeLine = GetFreeLineByItemID(kv.Key, current.ServiceCaseID);

                    if (freeLine == null)
                    {
                        if (kv.Value > 0)
                        {
                            var line = new CRServiceCaseItem();
                            line.InventoryID    = kv.Key;
                            line.IsFree         = true;
                            line.SiteID         = defaultWarehouse;
                            line.ActualQuantity = kv.Value;

                            FreeItems.Insert(line);

                            freeItemChanged = true;
                        }
                    }
                    else
                    {
                        freeLine.ActualQuantity = kv.Value;                         //TODO: need set other fields

                        FreeItems.Update(freeLine);

                        freeItemChanged = true;
                    }
                }
            }
            finally
            {
                RowDeleted.AddHandler(typeof(CRServiceCaseItem), CRServiceCaseItem_RowDeleted);
                RowInserted.AddHandler(typeof(CRServiceCaseItem), CRServiceCaseItem_RowInserted);
                RowUpdated.AddHandler(typeof(CRServiceCaseItem), CRServiceCaseItem_RowUpdated);
            }

            if (freeItemChanged)
            {
                Details.View.RequestRefresh();
            }
        }