private bool PaymentCycleWorkflowIsStartedAndItIsOtherPayment(string paymentDocType, string paymentRefNbr, string origDocType, string origRefNbr)
        {
            PXResult <APInvoice, APAdjust>[] records = PXSelectJoinGroupBy <APInvoice,
                                                                            InnerJoin <APAdjust,
                                                                                       On <APAdjust.adjdDocType, Equal <APInvoice.docType>,
                                                                                           And <APAdjust.adjdRefNbr, Equal <APInvoice.refNbr>,
                                                                                                And <APAdjust.voided, Equal <False> > > > >,
                                                                            Where2 <Where <APAdjust.adjgDocType, Equal <Required <APAdjust.adjgDocType> >,
                                                                                           And <APAdjust.adjgRefNbr, Equal <Required <APAdjust.adjgRefNbr> >,
                                                                                                Or <APInvoiceJCExt.isPaymentCycleWorkflow, Equal <True> > > >,
                                                                                    And <Where <APInvoice.origDocType, Equal <Required <APInvoice.origDocType> >,
                                                                                                And <APInvoice.origRefNbr, Equal <Required <APInvoice.origRefNbr> >,
                                                                                                     And <APInvoice.isRetainageDocument, Equal <True>,
                                                                                                          Or <APInvoice.docType, Equal <Required <APInvoice.docType> >,
                                                                                                              And <APInvoice.refNbr, Equal <Required <APInvoice.refNbr> > > > > > > > >,
                                                                            Aggregate <GroupBy <APInvoiceJCExt.isPaymentCycleWorkflow,
                                                                                                GroupBy <APAdjust.adjgRefNbr,
                                                                                                         GroupBy <APAdjust.adjgDocType> > > > >
                                                       .Select(Graph, paymentDocType, paymentRefNbr, origDocType, origRefNbr, origDocType, origRefNbr)
                                                       .AsEnumerable()
                                                       .Cast <PXResult <APInvoice, APAdjust> >()
                                                       .ToArray();

            return(records.Any(record => ((APInvoice)record).GetExtension <APInvoiceJCExt>().IsPaymentCycleWorkflow == true) &&
                   !records.Any(record =>
            {
                APAdjust adjust = record;
                return adjust.AdjgDocType == paymentDocType && adjust.AdjgRefNbr == paymentRefNbr;
            }));
        }
Ejemplo n.º 2
0
        protected virtual void _(Events.FieldSelecting <POOrderPrepayment.statusText> e)
        {
            if (Base.Document.Current == null || e.Row == null)
            {
                return;
            }

            var query =
                new PXSelectJoinGroupBy <POOrderPrepayment,
                                         InnerJoin <APRegister, On <APRegister.docType, Equal <POOrderPrepayment.aPDocType>, And <APRegister.refNbr, Equal <POOrderPrepayment.aPRefNbr> > > >,
                                         Where <POOrderPrepayment.orderType, Equal <Current <POOrder.orderType> >, And <POOrderPrepayment.orderNbr, Equal <Current <POOrder.orderNbr> > > >,
                                         Aggregate <Sum <POOrderPrepayment.curyAppliedAmt, Sum <APRegister.curyDocBal> > > >(Base);

            using (new PXFieldScope(query.View,
                                    typeof(POOrderPrepayment.orderType), typeof(POOrderPrepayment.orderNbr), typeof(POOrderPrepayment.aPDocType), typeof(POOrderPrepayment.aPRefNbr),
                                    typeof(APRegister.docType), typeof(APRegister.refNbr),
                                    typeof(POOrderPrepayment.curyAppliedAmt), typeof(APRegister.curyDocBal)))
            {
                var prepaymentTotal = (PXResult <POOrderPrepayment, APRegister>)query.SelectWindowed(0, 1);

                e.ReturnValue = PXMessages.LocalizeFormatNoPrefix(Messages.StatusTotalPrepayments,
                                                                  Base.FormatQty(((POOrderPrepayment)prepaymentTotal)?.CuryAppliedAmt ?? 0),
                                                                  Base.FormatQty(((APRegister)prepaymentTotal)?.CuryDocBal ?? 0));
            }
        }
Ejemplo n.º 3
0
        public virtual IEnumerable orders()
        {
            foreach (SOOrder order in Orders.Cache.Updated)
            {
                yield return(order);
            }

            foreach (PXResult res in PXSelectJoinGroupBy <SOOrder,
                                                          InnerJoin <SOLine, On <SOLine.orderType, Equal <SOOrder.orderType>, And <SOLine.orderNbr, Equal <SOOrder.orderNbr> > >,
                                                                     InnerJoin <SOOrderType, On <SOOrderType.orderType, Equal <SOOrder.orderType> >,
                                                                                InnerJoin <SOOrderTypeOperation,
                                                                                           On <SOOrderTypeOperation.orderType, Equal <SOLine.orderType>,
                                                                                               And <SOOrderTypeOperation.operation, Equal <SOLine.operation> > >,
                                                                                           LeftJoin <ARTran, On <ARTran.sOOrderType, Equal <SOLine.orderType>, And <ARTran.sOOrderNbr, Equal <SOLine.orderNbr>, And <ARTran.sOOrderLineNbr, Equal <SOLine.lineNbr> > > >,
                                                                                                     LeftJoin <INTran, On <INTran.sOOrderType, Equal <SOLine.orderType>, And <INTran.sOOrderNbr, Equal <SOLine.orderNbr>, And <INTran.sOOrderLineNbr, Equal <SOLine.lineNbr> > > > > > > > >,
                                                          Where <SOOrder.hold, Equal <boolFalse>,
                                                                 And <SOOrderTypeOperation.iNDocType, NotEqual <INTranType.noUpdate>,
                                                                      And2 <Where <SOOrderType.aRDocType, Equal <ARDocType.noUpdate>, Or <ARTran.refNbr, IsNotNull> >,
                                                                            And <INTran.refNbr, IsNull> > > >,
                                                          Aggregate <GroupBy <SOOrder.orderType, GroupBy <SOOrder.orderNbr> > > > .Select(this))
            {
                SOOrder order;
                if ((order = (SOOrder)Orders.Cache.Locate(res[typeof(SOOrder)])) == null || Orders.Cache.GetStatus(order) == PXEntryStatus.Notchanged)
                {
                    yield return(res[typeof(SOOrder)]);
                }
            }

            Orders.Cache.IsDirty = false;
        }
Ejemplo n.º 4
0
        public virtual IEnumerable orders()
        {
            foreach (PXResult <POReceipt> res in PXSelectJoinGroupBy <POReceipt,
                                                                      LeftJoinSingleTable <Vendor, On <Vendor.bAccountID, Equal <POReceipt.vendorID> >,
                                                                                           InnerJoin <POReceiptLine, On <POReceiptLine.receiptNbr, Equal <POReceipt.receiptNbr> >,
                                                                                                      LeftJoin <APTran, On <APTran.receiptNbr, Equal <POReceiptLine.receiptNbr>,
                                                                                                                            And <APTran.receiptLineNbr, Equal <POReceiptLine.lineNbr> > > > > >,
                                                                      Where2 <Where <Vendor.bAccountID, IsNull, Or <Match <Vendor, Current <AccessInfo.userName> > > >,
                                                                              And <POReceipt.hold, Equal <boolFalse>,
                                                                                   And <POReceipt.released, Equal <boolFalse>,
                                                                                        And <APTran.refNbr, IsNull> > > >,
                                                                      Aggregate <GroupBy <POReceipt.receiptNbr,
                                                                                          GroupBy <POReceipt.receiptType,
                                                                                                   GroupBy <POReceipt.released,
                                                                                                            GroupBy <POReceipt.hold,
                                                                                                                     GroupBy <POReceipt.autoCreateInvoice> > > > > > >
                     .Select(this))
            {
                POReceipt sel = res;
                POReceipt order;
                if ((order = (POReceipt)Orders.Cache.Locate(sel)) != null)
                {
                    sel.Selected = order.Selected;
                }

                yield return(sel);
            }
            Orders.Cache.IsDirty = false;
        }
        protected virtual void PMProject_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            PMProject      pmProjectRow      = (PMProject)e.Row;
            PMProjectSSExt pmProjectSSExtRow = PXCache <PMProject> .GetExtension <PMProjectSSExt>(pmProjectRow);

            pmProjectSSExtRow.SyncedInSmartsheet = pmProjectSSExtRow.UsrSmartsheetContractID != null;

            Dictionary <string, string> fields = new Dictionary <string, string>();

            foreach (PMTemplateListSS pmTemplateListSSRow in PXSelectJoinGroupBy <
                         PMTemplateListSS,
                         InnerJoin <PMSSMapping,
                                    On <PMSSMapping.templateSS, Equal <PMTemplateListSS.templateSS>,
                                        And <PMSSMapping.nameAcu, IsNotNull,
                                             And <PMSSMapping.nameAcu, NotEqual <Required <PMSSMapping.nameAcu> > > > > >,
                         Aggregate <
                             GroupBy <PMTemplateListSS.templateSS> > >
                     .Select(this.Base, ""))
            {
                fields.Add(pmTemplateListSSRow.TemplateSS, pmTemplateListSSRow.TemplateName);
            }
            PXStringListAttribute.SetList <PMProjectSSExt.usrTemplateSS>(sender, pmProjectRow, fields.Keys.ToArray(), fields.Values.ToArray());
            PXUIFieldAttribute.SetEnabled <PMProjectSSExt.usrTemplateSS>(sender, pmProjectRow, !(bool)pmProjectSSExtRow.SyncedInSmartsheet);
        }
Ejemplo n.º 6
0
        protected virtual IEnumerable customers()
        {
            BillingFilter filter = Filter.Current;

            if (filter == null)
            {
                yield break;
            }
            bool found = false;

            foreach (CustomersList item in Customers.Cache.Inserted)
            {
                found = true;
                yield return(item);
            }
            if (found)
            {
                yield break;
            }

            PXSelectBase <EPExpenseClaimDetails> sel = new PXSelectJoinGroupBy <EPExpenseClaimDetails, InnerJoin <Customer, On <EPExpenseClaimDetails.customerID, Equal <Customer.bAccountID> >,
                                                                                                                  LeftJoin <Contract, On <EPExpenseClaimDetails.contractID, Equal <Contract.contractID> > > >,
                                                                                Where <EPExpenseClaimDetails.released, Equal <boolTrue>,
                                                                                       And <EPExpenseClaimDetails.billable, Equal <boolTrue>,
                                                                                            And <EPExpenseClaimDetails.billed, Equal <boolFalse>,
                                                                                                 And <EPExpenseClaimDetails.expenseDate, LessEqual <Current <BillingFilter.endDate> > > > > >,
                                                                                Aggregate <GroupBy <EPExpenseClaimDetails.customerID,
                                                                                                    GroupBy <EPExpenseClaimDetails.customerLocationID> > > >(this);

            if (filter.CustomerClassID != null)
            {
                sel.WhereAnd <Where <Customer.customerClassID, Equal <Current <BillingFilter.customerClassID> > > >();
            }
            if (filter.CustomerID != null)
            {
                sel.WhereAnd <Where <Customer.bAccountID, Equal <Current <BillingFilter.customerID> > > >();
            }

            foreach (PXResult <EPExpenseClaimDetails, Customer, Contract> res in sel.Select())
            {
                CustomersList         retitem      = new CustomersList();
                Customer              customer     = res;
                EPExpenseClaimDetails claimdetaisl = res;
                Contract              contract     = (Contract)res;

                if (contract.BaseType == PMProject.ProjectBaseType.Project)
                {
                    continue;
                }


                retitem.CustomerID      = customer.BAccountID;
                retitem.LocationID      = claimdetaisl.CustomerLocationID;
                retitem.CustomerClassID = customer.CustomerClassID;

                retitem.Selected = false;

                yield return(Customers.Insert(retitem));
            }
        }
Ejemplo n.º 7
0
        public virtual IEnumerable languageSearchSettings()
        {
            var cache         = LanguageSearchSettings.Cache;
            var oldDirtyValue = cache.IsDirty;

            foreach (PXResult <SMLanguageSearchSettings, WikiPageLanguage> record in
                     PXSelectJoinGroupBy <SMLanguageSearchSettings,
                                          RightJoin <WikiPageLanguage, On <WikiPageLanguage.language, Equal <SMLanguageSearchSettings.name> > >,
                                          Where <SMLanguageSearchSettings.userID, IsNull,
                                                 Or <SMLanguageSearchSettings.userID, Equal <Current <AccessInfo.userID> > > >,
                                          Aggregate <GroupBy <WikiPageLanguage.language,
                                                              GroupBy <SMLanguageSearchSettings.userID,
                                                                       GroupBy <SMLanguageSearchSettings.active> > > > > .
                     Select(this))
            {
                var langSettings = (SMLanguageSearchSettings)record;
                var pageLanguage = (WikiPageLanguage)record;
                if (langSettings.UserID == null)
                {
                    var fieldValues = new OrderedDictionary
                    {
                        { cache.GetField(typeof(SMLanguageSearchSettings.name)), pageLanguage.Language },
                        { cache.GetField(typeof(SMLanguageSearchSettings.userID)), PXAccess.GetUserID() },
                        { cache.GetField(typeof(SMLanguageSearchSettings.active)), false }
                    };
                    cache.Insert(fieldValues);
                    langSettings = (SMLanguageSearchSettings)cache.Current;
                }
                yield return(langSettings);
            }
            cache.IsDirty = oldDirtyValue;
        }
Ejemplo n.º 8
0
        protected virtual void CSBox_RowDeleting(PXCache sender, PXRowDeletingEventArgs e)
        {
            CSBox box           = (CSBox)e.Row;
            var   openShipments = PXSelectJoinGroupBy <SOShipment,
                                                       InnerJoin <SOPackageDetail, On <SOPackageDetail.shipmentNbr, Equal <SOShipment.shipmentNbr> > >,
                                                       Where <SOPackageDetail.boxID, Equal <Required <CSBox.boxID> >,
                                                              And <SOShipment.released, NotEqual <True> > >,
                                                       Aggregate <GroupBy <SOShipment.shipmentNbr> > >
                                  .SelectWindowed(this, 0, 10, box.BoxID).RowCast <SOShipment>().ToList();

            if (openShipments.Any())
            {
                throw new PXException(Messages.BoxUsedInShipments, string.Join(", ", openShipments.Select(_ => _.ShipmentNbr).Distinct()));
            }

            var openOrders = PXSelectJoinGroupBy <SOOrder,
                                                  InnerJoin <SOPackageInfo, On <SOPackageInfo.FK.Order> >,
                                                  Where <SOPackageInfo.boxID, Equal <Required <CSBox.boxID> >,
                                                         And <SOOrder.completed, NotEqual <True>, And <SOOrder.cancelled, NotEqual <True> > > >,
                                                  Aggregate <GroupBy <SOOrder.orderType, GroupBy <SOOrder.orderNbr> > > >
                             .SelectWindowed(this, 0, 10, box.BoxID).RowCast <SOOrder>().ToList();

            if (openOrders.Any())
            {
                var ordersString = new StringBuilder();
                openOrders.ForEach(_ => ordersString.AppendFormat("{0} {1}, ", _.OrderType, _.OrderNbr));
                ordersString.Remove(ordersString.Length - 2, 2);

                throw new PXException(Messages.BoxUsedInOrders, ordersString);
            }
        }
Ejemplo n.º 9
0
        public virtual void CCTransactionsHistoryFilter_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
        {
            CCTransactionsHistoryFilter row    = (CCTransactionsHistoryFilter)e.Row;
            CCTransactionsHistoryFilter oldRow = (CCTransactionsHistoryFilter)e.OldRow;

            if (oldRow.PaymentMethodID != row.PaymentMethodID || oldRow.CardNumber != row.CardNumber || oldRow.PartialCardNumber != row.PartialCardNumber)
            {
                this.RecalcRow(row);
            }
            if (row.MaskedCardNumber != oldRow.MaskedCardNumber || row.DBSearchName != oldRow.DBSearchName)
            {
                PXResult <CustomerPaymentMethod> cnt = PXSelectJoinGroupBy <CustomerPaymentMethod, InnerJoin <Customer,
                                                                                                              On <Customer.bAccountID, Equal <CustomerPaymentMethod.bAccountID> > >,
                                                                            Where <CustomerPaymentMethod.paymentMethodID, Equal <Current <CCTransactionsHistoryFilter.paymentMethodID> >,
                                                                                   And <CustomerPaymentMethod.descr, Like <Optional <CCTransactionsHistoryFilter.maskedCardNumber> >,
                                                                                        And <Customer.acctName, Like <Optional <CCTransactionsHistoryFilter.dBSearchName> >,
                                                                                             And <CustomerPaymentMethod.isActive, Equal <True> > > > >,
                                                                            Aggregate <Count <CustomerPaymentMethod.pMInstanceID> > > .Select(this, row.MaskedCardNumber, row.DBSearchName);

                int count = 0;
                if (cnt != null && cnt.RowCount != null)
                {
                    count             = (int)cnt.RowCount;
                    row.NumberOfCards = cnt.RowCount;
                }
                row.PMInstanceID = count == 1 ? ((CustomerPaymentMethod)cnt).PMInstanceID : null;
            }
        }
Ejemplo n.º 10
0
        public virtual IEnumerable orders()
        {
            foreach (POReceipt order in Orders.Cache.Updated)
            {
                yield return(order);
            }

            foreach (PXResult res in PXSelectJoinGroupBy <POReceipt,
                                                          InnerJoin <Vendor, On <Vendor.bAccountID, Equal <POReceipt.vendorID> >,
                                                                     InnerJoin <POReceiptLine, On <POReceiptLine.receiptNbr, Equal <POReceipt.receiptNbr> >,
                                                                                LeftJoin <APTran, On <APTran.receiptNbr, Equal <POReceiptLine.receiptNbr>,
                                                                                                      And <APTran.receiptLineNbr, Equal <POReceiptLine.lineNbr> > > > > >,
                                                          Where2 <Match <Vendor, Current <AccessInfo.userName> >,
                                                                  And <POReceipt.hold, Equal <boolFalse>,
                                                                       And <POReceipt.released, Equal <boolFalse>,
                                                                            And <APTran.refNbr, IsNull> > > >,
                                                          Aggregate <GroupBy <POReceipt.receiptNbr,
                                                                              GroupBy <POReceipt.receiptType,
                                                                                       GroupBy <POReceipt.released,
                                                                                                GroupBy <POReceipt.hold,
                                                                                                         GroupBy <POReceipt.autoCreateInvoice> > > > > > >
                     .Select(this))
            {
                POReceipt order;
                if ((order = (POReceipt)Orders.Cache.Locate(res[typeof(POReceipt)])) == null ||
                    Orders.Cache.GetStatus(order) == PXEntryStatus.Notchanged)
                {
                    yield return(res[typeof(POReceipt)]);
                }
            }
            Orders.Cache.IsDirty = false;
        }
Ejemplo n.º 11
0
        public virtual IEnumerable transactions()
        {
            PXSelectBase <PMTran> select = new PXSelectJoinGroupBy <PMTran,
                                                                    LeftJoin <Account, On <Account.accountID, Equal <PMTran.offsetAccountID> >,
                                                                              LeftJoin <PMRegister, On <PMTran.tranType, Equal <PMRegister.module>, And <PMTran.refNbr, Equal <PMRegister.refNbr> > >,
                                                                                        LeftJoin <ARTran, On <ARTran.pMTranID, Equal <PMTran.tranID> >,
                                                                                                  LeftJoin <PMAllocationAuditTran, On <PMAllocationAuditTran.sourceTranID, Equal <PMTran.tranID> >,
                                                                                                            LeftJoin <PMTranEx, On <PMTranEx.tranID, Equal <PMAllocationAuditTran.tranID> > > > > > >,
                                                                    Where <PMTran.projectID, Equal <Current <TranFilter.projectID> > >,
                                                                    Aggregate <GroupBy <PMTran.tranID, GroupBy <PMTran.billable, GroupBy <PMTran.useBillableQty, GroupBy <PMTran.allocated,
                                                                                                                                                                          GroupBy <PMTran.released, GroupBy <PMTran.billed, GroupBy <PMTran.reversed, GroupBy <PMTran.isNonGL, GroupBy <PMTran.isQtyOnly> > > > > > > > > > >(this);

            TranFilter filter = this.Filter.Current;

            if (filter != null)
            {
                if (filter.AccountGroupID != null)
                {
                    select.WhereAnd <Where <PMTran.accountGroupID, Equal <Current <TranFilter.accountGroupID> >, Or <Account.accountGroupID, Equal <Current <TranFilter.accountGroupID> > > > >();
                }
                if (filter.ProjectTaskID != null)
                {
                    select.WhereAnd <Where <PMTran.taskID, Equal <Current <TranFilter.projectTaskID> > > >();
                }
                if (filter.InventoryID != null)
                {
                    select.WhereAnd <Where <PMTran.inventoryID, Equal <Current <TranFilter.inventoryID> > > >();
                }
                if (filter.ResourceID != null)
                {
                    select.WhereAnd <Where <PMTran.resourceID, Equal <Current <TranFilter.resourceID> > > >();
                }
                if (filter.OnlyAllocation == true)
                {
                    select.WhereAnd <Where <PMRegister.isAllocation, Equal <True> > >();
                }
                if (filter.DateFrom != null && filter.DateTo != null)
                {
                    if (filter.DateFrom == filter.DateTo)
                    {
                        select.WhereAnd <Where <PMTran.date, Equal <Current <TranFilter.dateFrom> > > >();
                    }
                    else
                    {
                        select.WhereAnd <Where <PMTran.date, Between <Current <TranFilter.dateFrom>, Current <TranFilter.dateTo> > > >();
                    }
                }
                else if (filter.DateFrom != null)
                {
                    select.WhereAnd <Where <PMTran.date, GreaterEqual <Current <TranFilter.dateFrom> > > >();
                }
                else if (filter.DateTo != null)
                {
                    select.WhereAnd <Where <PMTran.date, LessEqual <Current <TranFilter.dateTo> > > >();
                }
            }

            return(select.Select());
        }
Ejemplo n.º 12
0
        public virtual void PMEnsureInitialized()
        {
            if (_historyLoaded == null)
            {
                _reportPeriods = new RMReportPeriods <PMHistory>(this.Base);

                var accountGroupSelect = new PXSelect <PMAccountGroup>(this.Base);
                accountGroupSelect.View.Clear();
                accountGroupSelect.Cache.Clear();

                var projectSelect = new PXSelect <PMProject, Where <PMProject.isTemplate, Equal <False>, And <PMProject.nonProject, Equal <False>, And <PMProject.baseType, Equal <PMProject.ProjectBaseType> > > > >(this.Base);
                projectSelect.View.Clear();
                projectSelect.Cache.Clear();

                var taskSelect = new PXSelectJoin <PMTask, InnerJoin <PMProject, On <PMTask.projectID, Equal <PMProject.contractID> > >, Where <PMProject.isTemplate, Equal <False>, And <PMProject.nonProject, Equal <False> > > >(this.Base);
                taskSelect.View.Clear();
                taskSelect.Cache.Clear();

                var itemSelect = new PXSelectJoinGroupBy <InventoryItem, InnerJoin <PMHistory, On <InventoryItem.inventoryID, Equal <PMHistory.inventoryID> > >, Aggregate <GroupBy <InventoryItem.inventoryID> > >(this.Base);
                itemSelect.View.Clear();
                itemSelect.Cache.Clear();

                if (Base.Report.Current.ApplyRestrictionGroups == true)
                {
                    projectSelect.WhereAnd <Where <Match <Current <AccessInfo.userName> > > >();
                    taskSelect.WhereAnd <Where <Match <Current <AccessInfo.userName> > > >();
                    itemSelect.WhereAnd <Where <Match <Current <AccessInfo.userName> > > >();
                }

                accountGroupSelect.Select();
                projectSelect.Select();
                taskSelect.Select();

                foreach (InventoryItem item in itemSelect.Select())
                {
                    //The PXSelectJoinGroupBy is read-only, and Inventory items won't be added to the cache. Add them manually.
                    itemSelect.Cache.SetStatus(item, PXEntryStatus.Notchanged);
                }

                _historySegments       = new HashSet <PMHistoryKeyTuple>();
                _pmhistoryPeriodsByKey = new Dictionary <PMHistoryKeyTuple, Dictionary <string, PMHistory> >();
                _historyLoaded         = new HashSet <int>();

                _accountGroupsRangeCache = new RMReportRange <PMAccountGroup>(Base, PM.AccountGroupAttribute.DimensionName, RMReportConstants.WildcardMode.Fixed, RMReportConstants.BetweenMode.Fixed);
                _projectsRangeCache      = new RMReportRange <PMProject>(Base, PM.ProjectAttribute.DimensionName, RMReportConstants.WildcardMode.Fixed, RMReportConstants.BetweenMode.Fixed);
                _tasksRangeCache         = new RMReportRange <PMTask>(Base, PM.ProjectTaskAttribute.DimensionName, RMReportConstants.WildcardMode.Normal, RMReportConstants.BetweenMode.Fixed);
                _itemRangeCache          = new RMReportRange <InventoryItem>(Base, IN.InventoryAttribute.DimensionName, RMReportConstants.WildcardMode.Fixed, RMReportConstants.BetweenMode.Fixed);

                //Add Inventory <OTHER> with InventoryID=0
                InventoryItem other = new InventoryItem
                {
                    InventoryCD = RMReportWildcard.EnsureWildcardForFixed(Messages.OtherItem, _itemRangeCache.Wildcard),
                    InventoryID = PMInventorySelectorAttribute.EmptyInventoryID,
                    Descr       = Messages.OtherItemDescription
                };
                itemSelect.Cache.SetStatus(other, PXEntryStatus.Notchanged);
            }
        }
        public static IEnumerable DriverRecordsDelegate(PXGraph graph, SharedClasses.RouteSelected_view routeSelected, PXFilter <DriverSelectionFilter> filter)
        {
            if (routeSelected.Current == null)
            {
                yield break;
            }

            List <object>             args          = new List <object>();
            PXSelectBase <EPEmployee> commandFilter = new PXSelectJoinGroupBy <EPEmployee,
                                                                               InnerJoin <FSRouteEmployee,
                                                                                          On <
                                                                                              FSRouteEmployee.employeeID, Equal <EPEmployee.bAccountID> >,
                                                                                          LeftJoin <FSRouteDocument,
                                                                                                    On <
                                                                                                        FSRouteDocument.driverID, Equal <FSRouteEmployee.employeeID>,
                                                                                                        And <
                                                                                                            FSRouteDocument.date, Equal <Required <FSRouteDocument.date> > > > > >,
                                                                               Where <
                                                                                   FSRouteEmployee.routeID, Equal <Required <FSRouteEmployee.routeID> >,
                                                                                   And <
                                                                                       FSxEPEmployee.sDEnabled, Equal <True>,
                                                                                       And <
                                                                                           FSxEPEmployee.isDriver, Equal <True> > > >,
                                                                               Aggregate <
                                                                                   GroupBy <
                                                                                       EPEmployee.bAccountID> >,
                                                                               OrderBy <
                                                                                   Asc <FSRouteEmployee.priorityPreference> > >(graph);

            args.Add(routeSelected.Current.Date);
            args.Add(routeSelected.Current.RouteID);

            if (filter.Current.ShowUnassignedDrivers == true)
            {
                commandFilter.WhereAnd <Where <FSRouteDocument.routeID, IsNull> >();
            }

            var bqlResultSet = commandFilter.Select(args.ToArray());

            foreach (PXResult <EPEmployee, FSRouteEmployee, FSRouteDocument> bqlResult in bqlResultSet)
            {
                EPEmployee      epEmployeeRow      = (EPEmployee)bqlResult;
                FSRouteEmployee fsRouteEmployeeRow = (FSRouteEmployee)bqlResult;
                FSRouteDocument fsRouteDocumentRow = (FSRouteDocument)bqlResult;

                FSxEPEmployee fsxEPEmployeeRow = PXCache <EPEmployee> .GetExtension <FSxEPEmployee>(epEmployeeRow);

                if (fsRouteDocumentRow != null && fsRouteDocumentRow.RouteID != null)
                {
                    fsxEPEmployeeRow.Mem_UnassignedDriver = true;
                }

                yield return(bqlResult);
            }
        }
Ejemplo n.º 14
0
        protected virtual void MISC1099EFileFilter_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            var rowfilter = e.Row as MISC1099EFileFilter;

            if (rowfilter == null)
            {
                return;
            }

            Records.SetProcessDelegate(
                delegate(List <MISC1099EFileProcessingInfo> list)
            {
                MISC1099EFileProcessing graph = CreateInstance <MISC1099EFileProcessing>();
                graph.Process(list, rowfilter);
            });

            if (rowfilter.Include == MISC1099EFileFilter.include.AllMarkedBranches)
            {
                List <string> uncheckedBranches = PXSelectJoinGroupBy <Branch,
                                                                       InnerJoin <Ledger, On <Ledger.ledgerID, Equal <Branch.ledgerID> >,
                                                                                  InnerJoin <AP1099History, On <Branch.branchID, Equal <AP1099History.branchID> > > >,
                                                                       Where2 <
                                                                           Where2 <Not <FeatureInstalled <FeaturesSet.branch> >,
                                                                                   Or2 <IsSingleBranchCompany,
                                                                                        Or <Ledger.defBranchID, IsNull,
                                                                                            Or <Ledger.defBranchID, Equal <Branch.branchID> > > > >,
                                                                           And2 <Where <Branch.reporting1099, NotEqual <True>, Or <Branch.reporting1099, IsNull> >,
                                                                                 And <MatchWithBranch <Branch.branchID> > > >,
                                                                       Aggregate <GroupBy <Branch.branchCD> > > .SelectWindowed(this, 0, 10)
                                                  .RowCast <Branch>()
                                                  .Select(branch => branch.BranchCD)
                                                  .ToList();

                uncheckedBranches.AddRange(PXSelectJoinGroupBy <Branch,
                                                                InnerJoin <Ledger, On <Ledger.defBranchID, Equal <Branch.branchID> >,
                                                                           InnerJoin <BranchAlias, On <Ledger.ledgerID, Equal <BranchAlias.ledgerID> >,
                                                                                      InnerJoin <AP1099History, On <BranchAlias.branchID, Equal <AP1099History.branchID> > > > >,
                                                                Where2 <Where <Branch.reporting1099, NotEqual <True>, Or <Branch.reporting1099, IsNull> >,
                                                                        And <MatchWithBranch <Branch.branchID> > >,
                                                                Aggregate <GroupBy <Branch.branchCD> > > .SelectWindowed(this, 0, 10)
                                           .RowCast <Branch>()
                                           .Select(branch => branch.BranchCD));

                string branches = (uncheckedBranches.Count > 10 ? uncheckedBranches.GetRange(0, 10) : uncheckedBranches).JoinToString(", ");
                sender.RaiseExceptionHandling <MISC1099EFileFilter.include>(rowfilter, rowfilter.Include,
                                                                            !string.IsNullOrEmpty(branches)
                                                ? new PXSetPropertyException(Messages.Unefiled1099Branches, PXErrorLevel.Warning, branches)
                                                : null);
            }
            else
            {
                sender.RaiseExceptionHandling <MISC1099EFileFilter.include>(rowfilter, rowfilter.Include, null);
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Keep synchronized the Customer's Billing Cycle settings when Multiple Billing Cycle option is turn on from Setup screen.
        /// </summary>
        public virtual void KeepCustomerMultBillCyleSettings(PXGraph setupGraph)
        {
            PXResultset <FSServiceOrder> customersAffectedRows = PXSelectJoinGroupBy <FSServiceOrder,
                                                                                      InnerJoin <Customer,
                                                                                                 On <
                                                                                                     Customer.bAccountID, Equal <FSServiceOrder.customerID> >,
                                                                                                 InnerJoin <FSSrvOrdType,
                                                                                                            On <
                                                                                                                FSSrvOrdType.srvOrdType, Equal <FSServiceOrder.srvOrdType> >,
                                                                                                            LeftJoin <FSCustomerBillingSetup,
                                                                                                                      On <
                                                                                                                          FSCustomerBillingSetup.customerID, Equal <Customer.bAccountID>,
                                                                                                                          And <FSCustomerBillingSetup.srvOrdType, Equal <FSServiceOrder.srvOrdType>,
                                                                                                                               And <FSCustomerBillingSetup.billingCycleID, Equal <FSxCustomer.billingCycleID> > > > > > >,
                                                                                      Where <
                                                                                          FSCustomerBillingSetup.billingCycleID, IsNull,
                                                                                          And <FSxCustomer.billingCycleID, IsNotNull,
                                                                                               And <FSSrvOrdType.active, Equal <True>,
                                                                                                    And <FSSrvOrdType.behavior, NotEqual <FSSrvOrdType.behavior.Quote> > > > >,
                                                                                      Aggregate <
                                                                                          GroupBy <FSServiceOrder.customerID,
                                                                                                   GroupBy <FSServiceOrder.srvOrdType> > >,
                                                                                      OrderBy <
                                                                                          Asc <FSServiceOrder.customerID> > >
                                                                 .Select(this);

            var graphCustomer  = PXGraph.CreateInstance <CustomerMaint>();
            int?lastCustomerID = null;

            foreach (FSServiceOrder currentCustomer in customersAffectedRows)
            {
                if (currentCustomer.CustomerID != lastCustomerID)
                {
                    graphCustomer.BAccount.Current = graphCustomer.BAccount.Search <Customer.bAccountID>(currentCustomer.CustomerID);
                    lastCustomerID = currentCustomer.CustomerID;
                }

                FSxCustomer fsxCustomerRow = graphCustomer.BAccount.Cache.GetExtension <FSxCustomer>(graphCustomer.BAccount.Current);

                if (fsxCustomerRow != null)
                {
                    SM_CustomerMaint sm_CustomerMaintGraph = graphCustomer.GetExtension <SM_CustomerMaint>();

                    FSCustomerBillingSetup fsCustomerBillingSetupRow = new FSCustomerBillingSetup();
                    fsCustomerBillingSetupRow.SrvOrdType         = currentCustomer.SrvOrdType;
                    fsCustomerBillingSetupRow.BillingCycleID     = fsxCustomerRow.BillingCycleID;
                    fsCustomerBillingSetupRow.SendInvoicesTo     = fsxCustomerRow.SendInvoicesTo;
                    fsCustomerBillingSetupRow.BillShipmentSource = fsxCustomerRow.BillShipmentSource;

                    sm_CustomerMaintGraph.CustomerBillingCycles.Insert(fsCustomerBillingSetupRow);
                    graphCustomer.Save.Press();
                }
            }
        }
        private bool IsCBIDRelatedToPostedDocuments(int?cBID)
        {
            int?rowCount = PXSelectJoinGroupBy <FSServiceOrder,
                                                InnerJoin <FSPostDoc,
                                                           On <FSPostDoc.sOID, Equal <FSServiceOrder.sOID> > >,
                                                Where <
                                                    FSServiceOrder.cBID, Equal <Required <FSServiceOrder.cBID> > >,
                                                Aggregate <Count> >
                           .Select(Base, cBID).RowCount;

            return(rowCount.HasValue && rowCount > 0);
        }
        protected virtual Dictionary <int, decimal> GetTranYTDCostTableByPeriod(string periodID)
        {
            if (string.IsNullOrEmpty(periodID))
            {
                throw new ArgumentNullException();
            }

            if (tranYTDCostTable != null)
            {
                return(tranYTDCostTable);
            }

            tranYTDCostTable = new Dictionary <int, decimal>();

            var select = new PXSelectJoinGroupBy <INItemCostHist,
                                                  InnerJoin <INItemCostHistByPeriod,
                                                             On <INItemCostHist.inventoryID, Equal <INItemCostHistByPeriod.inventoryID>,
                                                                 And <INItemCostHist.costSiteID, Equal <INItemCostHistByPeriod.costSiteID>,
                                                                      And <INItemCostHist.costSubItemID, Equal <INItemCostHistByPeriod.costSubItemID>,
                                                                           And <INItemCostHist.accountID, Equal <INItemCostHistByPeriod.accountID>,
                                                                                And <INItemCostHist.subID, Equal <INItemCostHistByPeriod.subID>,
                                                                                     And <INItemCostHist.finPeriodID, Equal <INItemCostHistByPeriod.lastActivityPeriod> > > > > > >,
                                                             LeftJoin <INLocation, On <INLocation.locationID, Equal <INItemCostHist.costSiteID>, And <INLocation.isCosted, Equal <True> > > > >,
                                                  Where <INItemCostHistByPeriod.finPeriodID, Equal <Required <INItemCostHistByPeriod.finPeriodID> > >,
                                                  Aggregate <
                                                      GroupBy <INItemCostHist.costSiteID,
                                                               GroupBy <INItemCostHist.inventoryID,
                                                                        GroupBy <INItemCostHist.finPeriodID,
                                                                                 Sum <INItemCostHist.tranYtdCost> > > > >
                                                  >(context);

            foreach (PXResult <INItemCostHist, INItemCostHistByPeriod, INLocation> res in select.Select(periodID))
            {
                INItemCostHist cost     = (INItemCostHist)res;
                INLocation     location = (INLocation)res;

                int?costSiteID = location.SiteID ?? cost.CostSiteID;
                if (costSiteID == siteID)
                {
                    if (!tranYTDCostTable.ContainsKey(cost.InventoryID.Value))
                    {
                        tranYTDCostTable.Add(cost.InventoryID.Value, cost.FinYtdCost.GetValueOrDefault());
                    }
                    else
                    {
                        tranYTDCostTable[cost.InventoryID.Value] += cost.FinYtdCost.GetValueOrDefault();
                    }
                }
            }

            return(tranYTDCostTable);
        }
		public IEnumerable customerPaymentMethodList()
		{
			var query = new PXSelectJoinGroupBy<CustomerPaymentMethod,
				LeftJoin<CustomerPaymentMethodDetail, On<CustomerPaymentMethodDetail.pMInstanceID, Equal<CustomerPaymentMethod.pMInstanceID>>>, 
				Where<CustomerPaymentMethod.paymentMethodID, Equal<Current<Filter.oldPaymentMethodID>>,
					And<CustomerPaymentMethod.cCProcessingCenterID, Equal<Current<Filter.oldCCProcessingCenterID>>,
					And<CustomerPaymentMethodDetail.value, IsNotNull>>>,
				Aggregate<GroupBy<CustomerPaymentMethod.pMInstanceID>>>(this);
			foreach (PXResult<CustomerPaymentMethod,CustomerPaymentMethodDetail> items in query.Select())
			{
				CustomerPaymentMethod cpm = (CustomerPaymentMethod)items;
				yield return cpm;
			}
		}
        protected virtual IEnumerable landedCostDetailsAdd()
        {
            PXSelectBase <POLandedCostDetailS> cmd = new PXSelectJoinGroupBy <POLandedCostDetailS,
                                                                              InnerJoin <POLandedCostDoc, On <POLandedCostDetailS.docType, Equal <POLandedCostDoc.docType>, And <POLandedCostDetailS.refNbr, Equal <POLandedCostDoc.refNbr> > >,
                                                                                         LeftJoin <POLandedCostReceiptLine, On <POLandedCostDetailS.docType, Equal <POLandedCostReceiptLine.docType>, And <POLandedCostDetailS.refNbr, Equal <POLandedCostReceiptLine.refNbr> > >,
                                                                                                   LeftJoin <POReceiptLine, On <POLandedCostReceiptLine.pOReceiptNbr, Equal <POReceiptLine.receiptNbr>, And <POLandedCostReceiptLine.pOReceiptLineNbr, Equal <POReceiptLine.lineNbr> > > > > >,
                                                                              Where <POLandedCostDetailS.aPRefNbr, IsNull,
                                                                                     And2 <Where <POLandedCostDoc.vendorID, Equal <Current <APRegister.vendorID> >, Or <FeatureInstalled <FeaturesSet.vendorRelations> > >,
                                                                                           And2 <Where <POLandedCostDoc.vendorLocationID, Equal <Current <APRegister.vendorLocationID> >, Or <FeatureInstalled <FeaturesSet.vendorRelations> > >,
                                                                                                 And2 <Where <POLandedCostDoc.payToVendorID, Equal <Current <APRegister.vendorID> >, Or <Not <FeatureInstalled <FeaturesSet.vendorRelations> > > >,
                                                                                                       And <POLandedCostDoc.curyID, Equal <Current <APRegister.curyID> >,
                                                                                                            And <POLandedCostDoc.released, Equal <True>,
                                                                                                                 And2 <Where <Current <POLandedCostDetailFilter.receiptNbr>, IsNull, Or <Current <POLandedCostDetailFilter.receiptNbr>, Equal <POLandedCostReceiptLine.pOReceiptNbr> > >,
                                                                                                                       And2 <Where <Current <POLandedCostDetailFilter.orderNbr>, IsNull,
                                                                                                                                    Or <Where <Current <POLandedCostDetailFilter.orderType>, Equal <POReceiptLine.pOType>,
                                                                                                                                               And <Current <POLandedCostDetailFilter.orderNbr>, Equal <POReceiptLine.pONbr> > > > >,
                                                                                                                             And2 <Where <Current <POLandedCostDetailFilter.landedCostDocRefNbr>, IsNull, Or <Current <POLandedCostDetailFilter.landedCostDocRefNbr>, Equal <POLandedCostDetailS.refNbr> > >,
                                                                                                                                   And <Where <Current <POLandedCostDetailFilter.landedCostCodeID>, IsNull, Or <Current <POLandedCostDetailFilter.landedCostCodeID>, Equal <POLandedCostDetailS.landedCostCodeID> > > >
                                                                                                                                   > > > > > > > > >,
                                                                              Aggregate <GroupBy <POLandedCostDetailS.docType, GroupBy <POLandedCostDetailS.refNbr, GroupBy <POLandedCostDetailS.lineNbr> > > > >(Base);

            int startRow  = PXView.StartRow;
            int totalRows = 0;

            var result = cmd.View.Select(PXView.Currents, PXView.Parameters, new object[PXView.SortColumns.Length], PXView.SortColumns,
                                         PXView.Descendings, PXView.Filters, ref startRow, PXView.MaximumRows, ref totalRows).RowCast <POLandedCostDetailS>().ToList();

            PXView.StartRow = 0;

            foreach (var poLandedCostDetail in Base.Caches <POLandedCostDetail>().Updated.RowCast <POLandedCostDetail>())
            {
                var tmpResultItem = result.RowCast <POLandedCostDetailS>().SingleOrDefault(t =>
                                                                                           t.DocType == poLandedCostDetail.DocType && t.RefNbr == poLandedCostDetail.RefNbr &&
                                                                                           t.LineNbr == poLandedCostDetail.LineNbr);

                if (tmpResultItem != null)
                {
                    tmpResultItem.APDocType = poLandedCostDetail.APDocType;
                    tmpResultItem.APRefNbr  = poLandedCostDetail.APRefNbr;
                }
            }

            if (Base.Document.Current != null)
            {
                result = result.Where(t => t.APRefNbr != Base.Document.Current.RefNbr).ToList();
            }

            return(result);
        }
Ejemplo n.º 20
0
 private string GetDirectSaleIndicator(PXGraph graph, int VendorID, string FinYear)
 {
     using (new PXReadBranchRestrictedScope(MarkedBranches))
     {
         foreach (PXResult <AP1099History, AP1099Box> dataRec in PXSelectJoinGroupBy <AP1099History,
                                                                                      InnerJoin <AP1099Box, On <AP1099Box.boxNbr, Equal <AP1099History.boxNbr> > >,
                                                                                      Where <AP1099History.vendorID, Equal <Required <AP1099History.vendorID> >,
                                                                                             And <AP1099History.boxNbr, Equal <Required <AP1099History.boxNbr> >,
                                                                                                  And <AP1099History.finYear, Equal <Required <AP1099History.finYear> > > > >,
                                                                                      Aggregate <GroupBy <AP1099History.boxNbr, Sum <AP1099History.histAmt> > > > .Select(graph, VendorID, 9, FinYear))
         {
             return((((AP1099History)dataRec).HistAmt >= ((AP1099Box)dataRec).MinReportAmt) ? "1" : string.Empty);
         }
     }
     return(string.Empty);
 }
Ejemplo n.º 21
0
 public virtual IEnumerable enqResults()
 {
     foreach (var result in PXSelectJoinGroupBy <ARDunningLetter,
                                                 LeftJoin <Customer, On <Customer.bAccountID, Equal <ARDunningLetter.bAccountID> >,
                                                           LeftJoin <ARDunningLetterDetail, On <ARDunningLetterDetail.dunningLetterID, Equal <ARDunningLetter.dunningLetterID> > > >,
                                                 Where2 <Where <ARDunningLetter.bAccountID, Equal <Current <DLByCustomerFilter.bAccountID> >, Or <Current <DLByCustomerFilter.bAccountID>, IsNull> >,
                                                         And <ARDunningLetter.dunningLetterDate, GreaterEqual <Current <DLByCustomerFilter.beginDate> >,
                                                              And <ARDunningLetter.dunningLetterDate, LessEqual <Current <DLByCustomerFilter.endDate> > > > >,
                                                 Aggregate <GroupBy <ARDunningLetter.dunningLetterID, GroupBy <ARDunningLetter.released, GroupBy <ARDunningLetter.voided, Sum <ARDunningLetterDetail.overdueBal, Count <ARDunningLetterDetail.refNbr> > > > > >,
                                                 OrderBy <Asc <ARDunningLetter.dunningLetterDate> > > .Select(this))
     {
         ARDunningLetter letter = (ARDunningLetter)result;
         letter.DetailsCount = result.RowCount;
         yield return(result);
     }
 }
Ejemplo n.º 22
0
        protected virtual PXSelectBase <SOOrder> BuildCommandCreateShipment(SOOrderFilter filter)
        {
            PXSelectBase <SOOrder> cmd = new PXSelectJoinGroupBy <SOOrder,
                                                                  InnerJoin <SOOrderType, On <SOOrderType.orderType, Equal <SOOrder.orderType> >,
                                                                             LeftJoin <Carrier, On <SOOrder.shipVia, Equal <Carrier.carrierID> >,
                                                                                       InnerJoin <SOShipmentPlan,
                                                                                                  On <SOOrder.orderType, Equal <SOShipmentPlan.orderType>,
                                                                                                      And <SOOrder.orderNbr, Equal <SOShipmentPlan.orderNbr> > >,
                                                                                                  InnerJoin <INSite, On <INSite.siteID, Equal <SOShipmentPlan.siteID> >,
                                                                                                             LeftJoin <SOOrderShipment,
                                                                                                                       On <SOOrderShipment.orderType, Equal <SOShipmentPlan.orderType>,
                                                                                                                           And <SOOrderShipment.orderNbr, Equal <SOShipmentPlan.orderNbr>,
                                                                                                                                And <SOOrderShipment.siteID, Equal <SOShipmentPlan.siteID>,
                                                                                                                                     And <SOOrderShipment.confirmed, Equal <boolFalse> > > > >,
                                                                                                                       LeftJoinSingleTable <Customer, On <SOOrder.customerID, Equal <Customer.bAccountID> > > > > > > >,
                                                                  Where <SOShipmentPlan.inclQtySOBackOrdered, Equal <short0>, And <SOOrderShipment.shipmentNbr, IsNull,
                                                                                                                                   And2 <Where <Customer.bAccountID, IsNull, Or <Match <Customer, Current <AccessInfo.userName> > > >,
                                                                                                                                         And <Match <INSite, Current <AccessInfo.userName> > > > > >,
                                                                  Aggregate <
                                                                      GroupBy <SOOrder.orderType,
                                                                               GroupBy <SOOrder.orderNbr,
                                                                                        GroupBy <SOOrder.approved> > > > >(this);

            if (filter.SiteID != null)
            {
                cmd.WhereAnd <Where <SOShipmentPlan.siteID, Equal <Current <SOOrderFilter.siteID> > > >();
            }

            if (filter.DateSel == "S")
            {
                if (filter.EndDate != null)
                {
                    cmd.WhereAnd <Where <SOShipmentPlan.planDate, LessEqual <Current <SOOrderFilter.endDate> > > >();
                }

                if (filter.StartDate != null)
                {
                    cmd.WhereAnd <Where <SOShipmentPlan.planDate, GreaterEqual <Current <SOOrderFilter.startDate> > > >();
                }

                filter.DateSel = string.Empty;
            }

            return(cmd);
        }
Ejemplo n.º 23
0
        public IEnumerable <PXResult <GLTran, CurrencyInfo> > GetTaxableGLTransWithCuryInfoGroupedByDocumentAttrAndTaxCategory(int?branchID, string[] batchNbrs)
        {
            var childBranchIds = PXAccess.GetChildBranchIDs(GetBranchByID(branchID).BranchCD);

            return(PXSelectJoinGroupBy <GLTran,
                                        InnerJoin <CurrencyInfo,
                                                   On <GLTran.curyInfoID, Equal <CurrencyInfo.curyInfoID> > >,
                                        Where <GLTran.branchID, In <Required <GLTran.branchID> >,
                                               And <GLTran.batchNbr, In <Required <GLTran.batchNbr> >,
                                                    And <GLTran.taxCategoryID, IsNotNull,
                                                         And <GLTran.module, Equal <BatchModule.moduleGL> > > > >,
                                        Aggregate <GroupBy <GLTran.branchID,
                                                            GroupBy <GLTran.batchNbr,
                                                                     GroupBy <GLTran.refNbr,
                                                                              GroupBy <GLTran.taxCategoryID> > > > > >
                   .Select(_graph, childBranchIds, batchNbrs)
                   .Cast <PXResult <GLTran, CurrencyInfo> >());
        }
        public IEnumerable yearVendorSummary()
        {
            PXResultset <AP1099Box> list;

            using (new PXReadBranchRestrictedScope(YearVendorHeader.Current.MasterBranchID))
            {
                list = PXSelectJoinGroupBy <AP1099Box,
                                            LeftJoin <AP1099History, On <AP1099History.vendorID, Equal <Current <AP1099YearMaster.vendorID> >,
                                                                         And <AP1099History.boxNbr, Equal <AP1099Box.boxNbr>,
                                                                              And <AP1099History.finYear, Equal <Current <AP1099YearMaster.finYear> > > > > >,
                                            Where <Current <AP1099YearMaster.masterBranchID>, IsNotNull>,
                                            Aggregate <GroupBy <AP1099Box.boxNbr, Sum <AP1099History.histAmt> > > > .Select(this);

                //There is "masterBranch is not null" because select parameters must be changed after changing masterBranch.
                //If select parametrs is unchanged since last use this select will not be executed and return previous result.
            }
            return(list);
        }
        public static IEnumerable VehicleRecordsDelegate(PXGraph graph, SharedClasses.RouteSelected_view routeSelected, PXFilter <VehicleSelectionFilter> filter)
        {
            if (routeSelected.Current == null)
            {
                yield break;
            }

            List <object> args = new List <object>();

            PXSelectBase <FSVehicle> commandFilter = new PXSelectJoinGroupBy <FSVehicle,
                                                                              LeftJoin <FSRouteDocument,
                                                                                        On <
                                                                                            FSRouteDocument.vehicleID, Equal <FSVehicle.SMequipmentID>,
                                                                                            And <FSRouteDocument.date, Equal <Required <FSRouteDocument.date> > > > >,
                                                                              Where <
                                                                                  FSVehicle.isVehicle, Equal <True> >,
                                                                              Aggregate <
                                                                                  GroupBy <
                                                                                      FSVehicle.SMequipmentID> >,
                                                                              OrderBy <
                                                                                  Asc <FSServiceVehicleType.priorityPreference> > >(graph);

            args.Add(routeSelected.Current.Date);

            if (filter.Current.ShowUnassignedVehicles == true)
            {
                commandFilter.WhereAnd <Where <FSRouteDocument.routeID, IsNull> >();
            }

            var list = commandFilter.Select(args.ToArray());

            foreach (PXResult <FSVehicle, FSRouteDocument> bqlResult in list)
            {
                FSVehicle       fsEquipmentRow     = (FSVehicle)bqlResult;
                FSRouteDocument fsRouteDocumentRow = (FSRouteDocument)bqlResult;

                if (fsRouteDocumentRow != null && fsRouteDocumentRow.RouteID != null)
                {
                    fsEquipmentRow.Mem_UnassignedVehicle = true;
                }

                yield return(bqlResult);
            }
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Query to get data for calculation of the begin balances of accounts.
        /// </summary>
        /// <returns>Account;
        /// GLHistory: total of ptdDebit and ptdCredit of specified period;
        /// AH: total of finYtdBalance for last period activity period.</returns>
        public IEnumerable <PXResult <Account, GLHistory, AH> > GetAccountsWithDataToCalcBeginBalancesExcludingYTDNetIncAcc(int?branchID, int?ledgerID, string finPeriodID)
        {
            var glSetup        = GetGLSetup();
            var childBranchIds = PXAccess.GetChildBranchIDs(GetBranchByID(branchID).BranchCD);

            return(PXSelectJoinGroupBy <Account,
                                        LeftJoin <GLHistoryByPeriod,
                                                  On <GLHistoryByPeriod.branchID, In <Required <GLHistoryByPeriod.branchID> >,
                                                      And <GLHistoryByPeriod.ledgerID, Equal <Required <GLHistoryByPeriod.ledgerID> >,
                                                           And <Account.accountID, Equal <GLHistoryByPeriod.accountID>,
                                                                And <GLHistoryByPeriod.finPeriodID, Equal <Required <GLHistoryByPeriod.finPeriodID> >,
                                                                     And <Where2 <Where <Account.type, Equal <AccountType.asset>,
                                                                                         Or <Account.type, Equal <AccountType.liability> > >,
                                                                                  Or <Where <GLHistoryByPeriod.lastActivityPeriod, GreaterEqual <Required <GLHistoryByPeriod.lastActivityPeriod> >,                 // greater than the first period of a year
                                                                                             And <Where <Account.type, Equal <AccountType.expense>,
                                                                                                         Or <Account.type, Equal <AccountType.income> > > > > > > > > > > >,
                                                  //to get saldo in selected period
                                                  LeftJoin <GLHistory,
                                                            On <GLHistoryByPeriod.branchID, Equal <GLHistory.branchID>,
                                                                And <GLHistoryByPeriod.ledgerID, Equal <GLHistory.ledgerID>,
                                                                     And <GLHistoryByPeriod.accountID, Equal <GLHistory.accountID>,
                                                                          And <GLHistoryByPeriod.subID, Equal <GLHistory.subID>,
                                                                               And <GLHistoryByPeriod.finPeriodID, Equal <GLHistory.finPeriodID> > > > > >,
                                                            //to get ending balance for last activity period
                                                            LeftJoin <AH,
                                                                      On <GLHistoryByPeriod.ledgerID, Equal <AH.ledgerID>,
                                                                          And <GLHistoryByPeriod.branchID, Equal <AH.branchID>,
                                                                               And <GLHistoryByPeriod.accountID, Equal <AH.accountID>,
                                                                                    And <GLHistoryByPeriod.subID, Equal <AH.subID>,
                                                                                         And <GLHistoryByPeriod.lastActivityPeriod, Equal <AH.finPeriodID> > > > > > > > >,
                                        Where <Account.accountID, NotEqual <Required <Account.accountID> > >,                   // not YTD Net Income Account>,
                                        Aggregate <
                                            Sum <AH.finYtdBalance,
                                                 Sum <GLHistory.finPtdCredit,
                                                      Sum <GLHistory.finPtdDebit,
                                                           GroupBy <Account.accountID> > > > > >
                   .Select(_graph, childBranchIds,
                           ledgerID,
                           finPeriodID,
                           FinPeriodIDAttribute.GetFirstFinPeriodIDOfYear(finPeriodID),
                           glSetup.YtdNetIncAccountID)
                   .Cast <PXResult <Account, GLHistoryByPeriod, GLHistory, AH> >()
                   .Select(row => new PXResult <Account, GLHistory, AH>((Account)row, (GLHistory)row, (AH)row)));
        }
Ejemplo n.º 27
0
        private void CheckUnshiftedOrganizationCalendars()
        {
            List <string> organizations = PXSelectJoinGroupBy <
                OrganizationFinPeriod,
                InnerJoin <Organization,
                           On <OrganizationFinPeriod.organizationID, Equal <Organization.organizationID> > >,
                Where <OrganizationFinPeriod.finPeriodID, NotEqual <OrganizationFinPeriod.masterFinPeriodID> >,
                Aggregate <
                    GroupBy <Organization.organizationCD> > >
                                          .Select(this)
                                          .RowCast <Organization>()
                                          .Select(org => org.OrganizationCD.Trim())
                                          .ToList();

            if (organizations.Any())
            {
                throw new PXSetPropertyException(GL.Messages.ShiftedOrganizationCalendarsDetected, string.Join(", ", organizations));
            }
        }
Ejemplo n.º 28
0
 public virtual int GetListCount()
 {
     return((int)(PXSelectJoinGroupBy <CRActivity,
                                       LeftJoin <EPAttendee,
                                                 On <EPAttendee.userID, Equal <Current <AccessInfo.userID> >,
                                                     And <EPAttendee.eventNoteID, Equal <CRActivity.noteID> > >,
                                                 LeftJoin <CRReminder,
                                                           On <CRReminder.refNoteID, Equal <CRActivity.noteID>,
                                                               And <CRReminder.owner, Equal <Current <AccessInfo.userID> > > > > >,
                                       Where2 <Where <CRActivity.classID, Equal <CRActivityClass.task>,
                                                      Or <CRActivity.classID, Equal <CRActivityClass.events> > >,
                                               And2 <Where <CRActivity.uistatus, NotEqual <ActivityStatusAttribute.canceled>,
                                                            And <CRActivity.uistatus, NotEqual <ActivityStatusAttribute.completed>,
                                                                 And <CRActivity.uistatus, NotEqual <ActivityStatusAttribute.released> > > >,
                                                     And <CRReminder.reminderDate, IsNotNull,
                                                          And2 <Where <CRReminder.reminderDate, Less <Now>, And <CRReminder.dismiss, NotEqual <True> > >,
                                                                And <Where <CRReminder.owner, Equal <Current <AccessInfo.userID> >,
                                                                            Or <EPAttendee.userID, IsNotNull> > > > > > >,
                                       Aggregate <Count> > .Select(this).RowCount));
 }
Ejemplo n.º 29
0
        private static PXResultset <TaxHistory> GetTaxHistoryLines(PXGraph graph, int?curVendorBaccountID, string taxPeriodId, int?revisionId)
        {
            PXResultset <TaxHistory> lines =
                PXSelectJoinGroupBy <TaxHistory,
                                     InnerJoin <
                                         TaxReportLine,
                                         On <TaxReportLine.vendorID, Equal <TaxHistory.vendorID>,
                                             And <TaxReportLine.lineNbr, Equal <TaxHistory.lineNbr> > > >,
                                     Where <
                                         TaxHistory.vendorID, Equal <Required <TaxHistory.vendorID> >,
                                         And <TaxHistory.taxPeriodID, Equal <Required <TaxHistory.taxPeriodID> >,
                                              And <TaxHistory.revisionID, Equal <Required <TaxHistory.revisionID> > > > >,
                                     Aggregate <
                                         GroupBy <TaxHistory.branchID,
                                                  GroupBy <TaxReportLine.lineNbr,
                                                           GroupBy <TaxReportLine.netTax,
                                                                    Sum <TaxHistory.reportFiledAmt> > > > > >
                .Select(graph, curVendorBaccountID, taxPeriodId, revisionId);

            return(lines);
        }
Ejemplo n.º 30
0
        private void CheckFullLengthOrganizationCalendars()
        {
            List <string> organizations = PXSelectJoinGroupBy <
                MasterFinPeriod,
                CrossJoin <Organization,
                           LeftJoin <OrganizationFinPeriod,
                                     On <MasterFinPeriod.finPeriodID, Equal <OrganizationFinPeriod.masterFinPeriodID>,
                                         And <Organization.organizationID, Equal <OrganizationFinPeriod.organizationID> > > > >,
                Where <OrganizationFinPeriod.finPeriodID, IsNull>,
                Aggregate <
                    GroupBy <Organization.organizationCD> > >
                                          .Select(this)
                                          .RowCast <Organization>()
                                          .Select(org => org.OrganizationCD.Trim())
                                          .ToList();

            if (organizations.Any())
            {
                throw new PXSetPropertyException(GL.Messages.ShortOrganizationCalendarsDetected, string.Join(", ", organizations));
            }
        }