Ejemplo n.º 1
0
        protected virtual void DRScheduleDetail_DocumentType_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
        {
            DRScheduleDetail row = e.Row as DRScheduleDetail;

            if (row != null)
            {
                string newModule = DRScheduleDocumentType.ExtractModule(row.DocumentType);
                row.DocType = DRScheduleDocumentType.ExtractDocType(row.DocumentType);

                if (row.Module != newModule)
                {
                    row.Module     = newModule;
                    row.DefCode    = null;
                    row.DefAcctID  = null;
                    row.DefSubID   = null;
                    row.BAccountID = null;
                    row.AccountID  = null;
                    row.SubID      = null;

                    InventoryItem item = PXSelect <InventoryItem, Where <InventoryItem.inventoryID, Equal <Required <DRScheduleDetail.componentID> > > > .Select(this, row.ComponentID);

                    if (item != null)
                    {
                        row.AccountID = row.Module == BatchModule.AP ? item.COGSAcctID : item.SalesAcctID;
                        row.SubID     = row.Module == BatchModule.AP ? item.COGSSubID : item.SalesSubID;
                    }
                }

                row.RefNbr = null;
            }
        }
Ejemplo n.º 2
0
        protected virtual void DRSchedule_DocumentType_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
        {
            DRSchedule row = e.Row as DRSchedule;

            if (row != null)
            {
                string newModule = DRScheduleDocumentType.ExtractModule(row.DocumentType);
                row.DocType = DRScheduleDocumentType.ExtractDocType(row.DocumentType);
                row.Module  = newModule;

                if (row.Module == BatchModule.AR)
                {
                    row.BAccountType = CR.BAccountType.CustomerType;
                }
                else if (row.Module == BatchModule.AP)
                {
                    row.BAccountType = CR.BAccountType.VendorType;
                }
            }
        }