コード例 #1
0
        protected virtual void CAEntryType_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
        {
            CAEntryType row = e.NewRow as CAEntryType;

            if (row.AccountID != null)
            {
                Account currentAcc = PXSelect <Account, Where <Account.accountID, Equal <Required <Account.accountID> > > > .Select(this, row.AccountID);

                if (currentAcc.IsCashAccount == true)
                {
                    CashAccount cashAccount = PXSelect <CashAccount, Where <CashAccount.accountID, Equal <Required <CashAccount.accountID> >,
                                                                            And <CashAccount.subID, Equal <Required <CashAccount.subID> >,
                                                                                 And <CashAccount.branchID, Equal <Required <CashAccount.branchID> > > > > > .Select(this, row.AccountID, row.SubID, row.BranchID);

                    if (cashAccount == null)
                    {
                        string branchCD = (string)PXSelectorAttribute.GetField(sender, row, typeof(CAEntryType.branchID).Name, row.BranchID, typeof(Branch.branchCD).Name);
                        sender.RaiseExceptionHandling <CAEntryType.branchID>(row, branchCD,
                                                                             new PXSetPropertyException(Messages.NoCashAccountForBranchAndSub, PXErrorLevel.Error));
                        string subCD = (string)PXSelectorAttribute.GetField(sender, row, typeof(CAEntryType.subID).Name, row.SubID, typeof(Sub.subCD).Name);
                        sender.RaiseExceptionHandling <CAEntryType.subID>(row, subCD,
                                                                          new PXSetPropertyException(Messages.NoCashAccountForBranchAndSub, PXErrorLevel.Error));
                        e.Cancel = true;
                        return;
                    }
                }
            }
        }
コード例 #2
0
ファイル: CAReleaseProcess.cs プロジェクト: JeffJave/Ipevo
        public void OnReleaseComplete(ICADocument doc, OnReleaseCompleteDelegate baseMethod)
        {
            CAAdj cAAdj = doc as CAAdj;

            if (TWNGUIValidation.ActivateTWGUI(Base) == true &&
                cAAdj != null &&
                cAAdj.Released == true &&
                cAAdj.AdjTranType == CATranType.CAAdjustment)
            {
                TWNReleaseProcess rp = PXGraph.CreateInstance <TWNReleaseProcess>();

                PXSelectBase <TWNManualGUIBank> ViewManGUIBank = new SelectFrom <TWNManualGUIBank> .Where <TWNManualGUIBank.adjRefNbr.IsEqual <@P.AsString> > .View(Base);

                foreach (TWNManualGUIBank manualGUIBank in ViewManGUIBank.Cache.Cached)
                {
                    if (PXCache <Tax> .GetExtension <TaxExt>(Tax.PK.Find(Base, manualGUIBank.TaxID)).UsrTWNGUI.Equals(false))
                    {
                        continue;
                    }

                    using (PXTransactionScope ts = new PXTransactionScope())
                    {
                        rp.CreateGUITrans(new STWNGUITran()
                        {
                            VATCode      = manualGUIBank.VATInCode,
                            GUINbr       = manualGUIBank.GUINbr,
                            GUIStatus    = TWNGUIStatus.Used,
                            BranchID     = Base.CATranCashTrans_Ordered.Current.BranchID,
                            GUIDirection = TWNGUIDirection.Receipt,
                            GUIDate      = manualGUIBank.GUIDate,
                            GUITitle     = (string)PXSelectorAttribute.GetField(ViewManGUIBank.Cache, manualGUIBank,
                                                                                typeof(APRegister.vendorID).Name, manualGUIBank.VendorID,
                                                                                typeof(Vendor.acctName).Name),
                            TaxZoneID     = manualGUIBank.TaxZoneID,
                            TaxCategoryID = manualGUIBank.TaxCategoryID,
                            TaxID         = manualGUIBank.TaxID,
                            TaxNbr        = manualGUIBank.TaxNbr,
                            OurTaxNbr     = manualGUIBank.OurTaxNbr,
                            NetAmount     = manualGUIBank.NetAmt,
                            TaxAmount     = manualGUIBank.TaxAmt,
                            AcctCD        = (string)PXSelectorAttribute.GetField(ViewManGUIBank.Cache, manualGUIBank,
                                                                                 typeof(APRegister.vendorID).Name, manualGUIBank.VendorID,
                                                                                 typeof(Vendor.acctCD).Name),
                            AcctName = (string)PXSelectorAttribute.GetField(ViewManGUIBank.Cache, manualGUIBank,
                                                                            typeof(APRegister.vendorID).Name, manualGUIBank.VendorID,
                                                                            typeof(Vendor.acctName).Name),
                            DeductionCode = manualGUIBank.Deduction,
                            Remark        = manualGUIBank.Remark,
                            OrderNbr      = manualGUIBank.AdjRefNbr
                        });

                        ts.Complete(Base);
                    }
                }
            }

            baseMethod(doc);
        }
コード例 #3
0
        public virtual FLXProject CreateProject(CROpportunityProducts opporProd)
        {
            CROpportunity current    = this.Base.Opportunity.Current;
            FLXProject    flxProject = new FLXProject();
            PXFieldState  valueExt1  = this.Base.Opportunity.Cache.GetValueExt((object)current, "AttributeSALESREP") as PXFieldState;
            PXFieldState  valueExt2  = this.Base.Opportunity.Cache.GetValueExt((object)current, "AttributeSALESPERSO") as PXFieldState;
            PXFieldState  valueExt3  = this.Base.Opportunity.Cache.GetValueExt((object)current, "AttributeINDUSTRY") as PXFieldState;
            PXFieldState  valueExt4  = this.Base.Opportunity.Cache.GetValueExt((object)current, "AttributeAPPLICATIO") as PXFieldState;
            PXFieldState  valueExt5  = this.Base.Opportunity.Cache.GetValueExt((object)current, "AttributeDESIGNINPA") as PXFieldState;
            PXFieldState  valueExt6  = this.Base.Opportunity.Cache.GetValueExt((object)current, "AttributeCM") as PXFieldState;
            PXFieldState  valueExt7  = this.Base.Opportunity.Cache.GetValueExt((object)current, "AttributeDISTRY") as PXFieldState;
            PXFieldState  valueExt8  = this.Base.Opportunity.Cache.GetValueExt((object)current, "AttributeENDCUSTOME") as PXFieldState;

            if (valueExt1.Value != null)
            {
                flxProject.SalesRepID = new int?((int)PXSelectorAttribute.GetField(this.Base.bAccountBasic.Cache, (object)this.Base.BAccounts, "acctCD", valueExt1.Value, "bAccountID"));
            }
            if (valueExt2.Value != null)
            {
                flxProject.SalespersonID = new int?((int)PXSelectorAttribute.GetField(this.SalesPersonView.Cache, (object)this.SalesPersonView, "salesPersonCD", valueExt2.Value, "SalesPersonID"));
            }
            if (valueExt6.Value != null)
            {
                flxProject.CM = new int?((int)PXSelectorAttribute.GetField(this.Base.bAccountBasic.Cache, (object)this.Base.BAccounts, "acctCD", valueExt6.Value, "bAccountID"));
            }
            if (valueExt7.Value != null)
            {
                flxProject.Distributor = new int?((int)PXSelectorAttribute.GetField(this.Base.bAccountBasic.Cache, (object)this.Base.BAccounts, "acctCD", valueExt7.Value, "bAccountID"));
            }
            flxProject.Industry      = valueExt3.Value == null ? (string)null : valueExt3.Value.ToString();
            flxProject.Application   = valueExt4.Value == null ? (string)null : valueExt4.Value.ToString();
            flxProject.CountryID     = valueExt5.Value == null ? (string)null : OpportunityMaint_Extension.GetAddressCountry((PXGraph)this.Base, (string)valueExt5.Value);
            flxProject.EndCustomerID = new int?((int)PXSelectorAttribute.GetField(this.Base.bAccountBasic.Cache, (object)this.Base.BAccounts, "acctCD", valueExt8.Value, "bAccountID"));
            flxProject.OpportunityID = current.OpportunityID;
            flxProject.CustomerID    = current.BAccountID;
            flxProject.OpporLineNbr  = opporProd.LineNbr;
            flxProject.EAU           = opporProd.Qty;
            flxProject.VendorID      = opporProd.VendorID;
            flxProject.Descr         = opporProd.Descr;
            switch (OpportunityMaint_Extension.GetItemType((PXGraph)this.Base, opporProd.InventoryID))
            {
            case "F":
            case "M":
            case "A":
                flxProject.StockItem = opporProd.InventoryID;
                break;

            default:
                flxProject.NonStockItem = opporProd.InventoryID;
                break;
            }
            return(flxProject);
        }
コード例 #4
0
        /// <summary>
        /// Handles the CA transaction detail row updating event.
        /// </summary>
        /// <param name="tranDetailsCache">The transaction details cache.</param>
        /// <param name="e">Row updating event arguments.</param>
        public static void OnCATranDetailRowUpdatingEvent(PXCache tranDetailsCache, PXRowUpdatingEventArgs e)
        {
            ICATranDetail oldTranDetail = e.Row as ICATranDetail;
            ICATranDetail newTranDetail = e.NewRow as ICATranDetail;

            if (newTranDetail == null || tranDetailsCache == null)
            {
                return;
            }

            UpdateNewTranDetailCuryTranAmtOrCuryUnitPrice(tranDetailsCache, oldTranDetail, newTranDetail);

            if (newTranDetail.AccountID == null)
            {
                return;
            }

            Account currentAcc = PXSelect <Account,
                                           Where <Account.accountID, Equal <Required <Account.accountID> > > > .
                                 Select(tranDetailsCache.Graph, newTranDetail.AccountID);

            if (currentAcc?.IsCashAccount != true)
            {
                return;
            }

            CashAccount cashAccount = GetCashAccount(tranDetailsCache.Graph,
                                                     newTranDetail.AccountID,
                                                     newTranDetail.SubID,
                                                     newTranDetail.BranchID,
                                                     doSearchWithSubsetsOfArgs: false);

            if (cashAccount == null)
            {
                PXSetPropertyException exception = new PXSetPropertyException(Messages.NoCashAccountForBranchAndSub, PXErrorLevel.Error);
                string branchCD = (string)PXSelectorAttribute.GetField(tranDetailsCache,
                                                                       newTranDetail,
                                                                       nameof(ICATranDetail.BranchID),
                                                                       newTranDetail.BranchID,
                                                                       typeof(Branch.branchCD).Name);
                string subCD = (string)PXSelectorAttribute.GetField(tranDetailsCache,
                                                                    newTranDetail,
                                                                    nameof(ICATranDetail.SubID),
                                                                    newTranDetail.SubID,
                                                                    typeof(Sub.subCD).Name);

                tranDetailsCache.RaiseExceptionHandling(nameof(ICATranDetail.BranchID), newTranDetail, branchCD, exception);
                tranDetailsCache.RaiseExceptionHandling(nameof(ICATranDetail.SubID), newTranDetail, subCD, exception);
                e.Cancel = true;
            }
        }
コード例 #5
0
        public virtual FLXCommissionTable CreateComisionTable(
            CROpportunityProducts opporProd)
        {
            FLXCommissionTable flxCommissionTable = new FLXCommissionTable();
            CROpportunity      current            = this.Base.Opportunity.Current;
            PXFieldState       valueExt           = this.Base.Opportunity.Cache.GetValueExt((object)current, "AttributeENDCUSTOME") as PXFieldState;

            flxCommissionTable.EndCustomerID = new int?((int)PXSelectorAttribute.GetField(this.Base.bAccountBasic.Cache, (object)this.Base.BAccounts, "acctCD", valueExt.Value, "bAccountID"));
            flxCommissionTable.CustomerID    = current.BAccountID;
            flxCommissionTable.OpportunityID = current.OpportunityID;
            flxCommissionTable.OpporLineNbr  = opporProd.LineNbr;
            flxCommissionTable.NonStock      = opporProd.InventoryID;
            return(flxCommissionTable);
        }
コード例 #6
0
        protected virtual void EPSetup_NonTaxableTipItem_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e)
        {
            if (e.NewValue != null)
            {
                TX.TaxCategory category = PXSelectJoin <TX.TaxCategory,
                                                        InnerJoin <IN.InventoryItem,
                                                                   On <IN.InventoryItem.taxCategoryID, Equal <TX.TaxCategory.taxCategoryID> > >,
                                                        Where <IN.InventoryItem.inventoryID, Equal <Required <EPSetup.nonTaxableTipItem> >,
                                                               And <TX.TaxCategory.active, Equal <True> > > > .Select(this, e.NewValue);

                if (category != null && category.TaxCategoryID != null && category.TaxCatFlag != null)
                {
                    PXSelectBase <TX.TaxRev> cmd;
                    if (category.TaxCatFlag == true)
                    {
                        cmd = new PXSelectJoin <TX.TaxRev,
                                                LeftJoin <TX.TaxCategoryDet,
                                                          On <TX.TaxRev.taxID, Equal <TX.TaxCategoryDet.taxID>,
                                                              And <TX.TaxCategoryDet.taxCategoryID, Equal <Required <TX.TaxCategory.taxCategoryID> > > > >,
                                                Where <TX.TaxRev.taxRate, NotEqual <decimal0>,
                                                       And <TX.TaxRev.taxRate, Greater <decimal0>,
                                                            And <TX.TaxCategoryDet.taxCategoryID, IsNull> > > >(this);
                    }
                    else
                    {
                        cmd = new PXSelectJoin <TX.TaxRev,
                                                InnerJoin <TX.TaxCategoryDet,
                                                           On <TX.TaxRev.taxID, Equal <TX.TaxCategoryDet.taxID>,
                                                               And <TX.TaxCategoryDet.taxCategoryID, Equal <Required <TX.TaxCategory.taxCategoryID> > > > >,
                                                Where <TX.TaxRev.taxRate, NotEqual <decimal0>,
                                                       And <TX.TaxRev.taxRate, Greater <decimal0> > > >(this);
                    }
                    if (cmd.Select(category.TaxCategoryID).Count > 0)
                    {
                        string inventoryCD = (string)PXSelectorAttribute.GetField(sender, e.Row, nameof(EPSetup.NonTaxableTipItem), e.NewValue, typeof(IN.InventoryItem.inventoryCD).Name);
                        e.NewValue = inventoryCD;
                        throw new PXSetPropertyException <EPSetup.nonTaxableTipItem>(Messages.TipItemAssociatedWithTaxes, PXErrorLevel.Error);
                    }
                    else
                    {
                        sender.RaiseExceptionHandling <EPSetup.nonTaxableTipItem>(e.Row, e.NewValue, null);
                    }
                }
                else
                {
                    sender.RaiseExceptionHandling <EPSetup.nonTaxableTipItem>(e.Row, e.NewValue, null);
                }
            }
        }
コード例 #7
0
        public static bool CheckReplaceComponentLines <TPartLine, TComponentLineRef>(PXCache cache, PXResultset <TPartLine> rows, IFSSODetBase currentRow)
            where TPartLine : class, IBqlTable, IFSSODetBase, new()
            where TComponentLineRef : IBqlField
        {
            if (currentRow == null)
            {
                return(true);
            }

            if (currentRow.EquipmentAction != ID.Equipment_Action.REPLACING_COMPONENT ||
                currentRow.SMEquipmentID == null ||
                currentRow.EquipmentLineRef == null)
            {
                return(true);
            }

            bool noErrors = true;

            foreach (TPartLine row in rows.RowCast <TPartLine>().Where(x => x.IsInventoryItem == true))
            {
                if (row.LineID != currentRow.LineID &&
                    row.EquipmentAction == currentRow.EquipmentAction &&
                    row.SMEquipmentID == currentRow.SMEquipmentID &&
                    row.EquipmentLineRef == currentRow.EquipmentLineRef)
                {
                    string componentLineRef = (string)PXSelectorAttribute.GetField(cache,
                                                                                   currentRow,
                                                                                   typeof(TComponentLineRef).Name,
                                                                                   currentRow.EquipmentLineRef,
                                                                                   typeof(FSEquipmentComponent.lineRef).Name);

                    cache.RaiseExceptionHandling <TComponentLineRef>(currentRow,
                                                                     componentLineRef,
                                                                     new PXSetPropertyException(TX.Error.SELECTED_COMPONENT_HAS_ALREADY_BEEN_CHOSEN_FOR_REPLACEMENT, PXErrorLevel.Error));

                    noErrors = false;
                }
            }

            return(noErrors);
        }