private void SetSingleBillingSettings(PXCache cache, Customer customerRow)
        {
            if (customerRow.CustomerClassID == null)
            {
                return;
            }

            FSxCustomer      fsxCustomerRow      = cache.GetExtension <FSxCustomer>(customerRow);
            FSxCustomerClass fsxCustomerClassRow = Base.CustomerClass.Cache.GetExtension <FSxCustomerClass>(Base.CustomerClass.Current);

            if (fsxCustomerClassRow == null)
            {
                return;
            }

            if (fsxCustomerClassRow.DfltBillingCycleID != null)
            {
                fsxCustomerRow.BillingCycleID = fsxCustomerClassRow.DfltBillingCycleID;
            }

            if (fsxCustomerClassRow.SendInvoicesTo != null)
            {
                fsxCustomerRow.SendInvoicesTo = fsxCustomerClassRow.SendInvoicesTo;
            }

            if (fsxCustomerClassRow.BillShipmentSource != null)
            {
                fsxCustomerRow.BillShipmentSource = fsxCustomerClassRow.BillShipmentSource;
            }
        }
        protected void Customer_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            Customer    customerRow    = (Customer)e.Row;
            FSxCustomer fsxCustomerRow = cache.GetExtension <FSxCustomer>(customerRow);

            PXUIFieldAttribute.SetEnabled <FSxCustomer.sendInvoicesTo>(cache, customerRow, fsxCustomerRow.BillingCycleID != null);
            PXUIFieldAttribute.SetEnabled <FSxCustomer.billShipmentSource>(cache, customerRow, fsxCustomerRow.BillingCycleID != null);

            DisplayCustomerBillingOptions(cache, customerRow, fsxCustomerRow);

            viewServiceOrderHistory.SetEnabled(customerRow.BAccountID > 0);
            viewAppointmentHistory.SetEnabled(customerRow.BAccountID > 0);
            viewEquipmentSummary.SetEnabled(customerRow.BAccountID > 0);
            viewContractScheduleSummary.SetEnabled(customerRow.BAccountID > 0);

            openMultipleStaffMemberBoard.SetEnabled(customerRow.BAccountID > 0);
            openSingleStaffMemberBoard.SetEnabled(customerRow.BAccountID > 0);

            EnableDisableCustomerBilling(cache, customerRow, fsxCustomerRow);
        }
        private void SetBillingCustomerSetting(PXCache cache, Customer customerRow)
        {
            FSxCustomer      fsxCustomerRow      = cache.GetExtension <FSxCustomer>(customerRow);
            FSxCustomerClass fsxCustomerClassRow = Base.CustomerClass.Cache.GetExtension <FSxCustomerClass>(Base.CustomerClass.Current);

            fsxCustomerRow.DefaultBillingCustomerSource = fsxCustomerClassRow.DefaultBillingCustomerSource;
            fsxCustomerRow.BillCustomerID = fsxCustomerClassRow.BillCustomerID;
            fsxCustomerRow.BillLocationID = fsxCustomerClassRow.BillLocationID;
        }
        /// <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();
                }
            }
        }
        protected virtual void FSCustomerBillingSetup_RowInserted(PXCache cache, PXRowInsertedEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            FSxCustomer fsxCustomerRow = PXCache <Customer> .GetExtension <FSxCustomer>(Base.BAccount.Current);

            fsxCustomerRow.BillingOptionsChanged = true;
        }
        protected void Customer_BillShipmentSource_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            Customer    customerRow    = (Customer)e.Row;
            FSxCustomer fsxCustomerRow = cache.GetExtension <FSxCustomer>(customerRow);

            InsertUpdateCustomerBillingSetup(cache, customerRow, fsxCustomerRow);
        }
Esempio n. 7
0
        /// <summary>
        /// Add the Customer info as a recipient in the Email template generated by Appointment.
        /// </summary>
        private static void AddCustomerRecipient(AppointmentEntry graphAppointmentEntry, NotificationRecipient recSetup, RecipientList recipients)
        {
            NotificationRecipient recipient = null;

            Customer customerRow = PXSelect <Customer,
                                             Where <
                                                 Customer.bAccountID, Equal <Required <Customer.bAccountID> > > >
                                   .Select(graphAppointmentEntry, graphAppointmentEntry.ServiceOrderRelated.Current.CustomerID);

            if (customerRow == null)
            {
                return;
            }

            FSxCustomer fsxCustomerRow = PXCache <Customer> .GetExtension <FSxCustomer>(customerRow);

            if (fsxCustomerRow.SendAppNotification == true)
            {
                if (graphAppointmentEntry.ServiceOrderRelated.Current.EMail != null)
                {
                    recipient = new NotificationRecipient()
                    {
                        Active = true,
                        Email  = graphAppointmentEntry.ServiceOrderRelated.Current.EMail,
                        Hidden = recSetup.Hidden,
                        Format = recSetup.Format
                    };
                }
                else
                {
                    Contact srvOrdContactRow = PXSelect <Contact,
                                                         Where <
                                                             Contact.contactID, Equal <Required <Contact.contactID> > > >
                                               .Select(graphAppointmentEntry, graphAppointmentEntry.ServiceOrderRelated.Current.ContactID);

                    if (srvOrdContactRow != null && srvOrdContactRow.EMail != null)
                    {
                        recipient = new NotificationRecipient()
                        {
                            Active = true,
                            Email  = srvOrdContactRow.EMail,
                            Hidden = recSetup.Hidden,
                            Format = recSetup.Format
                        };
                    }
                }

                if (recipient != null)
                {
                    recipients.Add(recipient);
                }
            }
        }
Esempio n. 8
0
        protected virtual void _(Events.RowDeleted <FSCustomerBillingSetup> e)
        {
            if (e.Row == null)
            {
                return;
            }

            FSCustomerBillingSetup fsCustomerBillingSetup = (FSCustomerBillingSetup)e.Row;
            FSxCustomer            fsxCustomerRow         = PXCache <Customer> .GetExtension <FSxCustomer>(Base.BAccount.Current);

            fsCustomerBillingSetup.IsBeingDeleted = true;
            e.Cache.SetValue <FSCustomerBillingSetup.active>(fsCustomerBillingSetup, false);
            fsxCustomerRow.BillingOptionsChanged = true;
        }
Esempio n. 9
0
        protected virtual void _(Events.FieldUpdated <Customer, FSxCustomer.billShipmentSource> e)
        {
            if (e.Row == null)
            {
                return;
            }

            Customer customerRow = (Customer)e.Row;
            PXCache  cache       = e.Cache;

            FSxCustomer fsxCustomerRow = cache.GetExtension <FSxCustomer>(customerRow);

            InsertUpdateCustomerBillingSetup(cache, customerRow, fsxCustomerRow);
        }
        protected void Customer_RowPersisting(PXCache cache, PXRowPersistingEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            Customer    customerRow    = (Customer)e.Row;
            FSxCustomer fsxCustomerRow = cache.GetExtension <FSxCustomer>(customerRow);

            if (e.Operation == PXDBOperation.Update)
            {
                VerifyPrepaidContractRelated(cache, customerRow, fsxCustomerRow);
            }
        }
        protected void Customer_CustomerClassID_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            Customer customerRow = (Customer)e.Row;

            if (this.doCopyBillingSettings == true)
            {
                FSxCustomer fsxCustomerRow = cache.GetExtension <FSxCustomer>(customerRow);
                SetBillingCycleFromCustomerClass(cache, customerRow);
                InsertUpdateCustomerBillingSetup(cache, customerRow, fsxCustomerRow);
            }

            SetBillingCustomerSetting(cache, customerRow);
        }
        protected void Customer_BillingCycleID_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            Customer    customerRow    = (Customer)e.Row;
            FSxCustomer fsxCustomerRow = cache.GetExtension <FSxCustomer>(customerRow);

            if (fsxCustomerRow.BillingCycleID == null)
            {
                fsxCustomerRow.SendInvoicesTo = ID.Send_Invoices_To.DEFAULT_BILLING_CUSTOMER_LOCATION;
            }

            ResetSendInvoicesToFromBillingCycle(customerRow, null);
            InsertUpdateCustomerBillingSetup(cache, customerRow, fsxCustomerRow);
        }
Esempio n. 13
0
        protected virtual void _(Events.FieldUpdated <Customer, Customer.customerClassID> e)
        {
            if (e.Row == null)
            {
                return;
            }

            Customer customerRow = (Customer)e.Row;
            PXCache  cache       = e.Cache;

            if (this.doCopyBillingSettings == true)
            {
                FSxCustomer fsxCustomerRow = cache.GetExtension <FSxCustomer>(customerRow);
                SetBillingCycleFromCustomerClass(cache, customerRow);
                InsertUpdateCustomerBillingSetup(cache, customerRow, fsxCustomerRow);
            }

            SetBillingCustomerSetting(cache, customerRow);
        }
        /// <summary>
        /// Resets the value from Send to Invoices dropdown if the billing cycle can not be sent to specific locations.
        /// </summary>
        private void ResetSendInvoicesToFromBillingCycle(Customer customerRow, FSCustomerBillingSetup fsCustomerBillingSetupRow)
        {
            List <object>  args = new List <object>();
            FSBillingCycle fsBillingCycleRow   = null;
            BqlCommand     billingCycleCommand = new Select <FSBillingCycle,
                                                             Where <
                                                                 FSBillingCycle.billingCycleID, Equal <Required <FSBillingCycle.billingCycleID> > > >();

            PXView billingCycleView = new PXView(Base, true, billingCycleCommand);

            if (customerRow != null)
            {
                FSxCustomer fsxCustomerRow = PXCache <Customer> .GetExtension <FSxCustomer>(customerRow);

                args.Add(fsxCustomerRow.BillingCycleID);

                fsBillingCycleRow = (FSBillingCycle)billingCycleView.SelectSingle(args.ToArray());

                if (fsBillingCycleRow != null)
                {
                    if (SharedFunctions.IsNotAllowedBillingOptionsModification(fsBillingCycleRow))
                    {
                        fsxCustomerRow.SendInvoicesTo     = ID.Send_Invoices_To.BILLING_CUSTOMER_BILL_TO;
                        fsxCustomerRow.BillShipmentSource = ID.Ship_To.SERVICE_ORDER_ADDRESS;
                    }
                }
            }
            else if (fsCustomerBillingSetupRow != null)
            {
                args.Add(fsCustomerBillingSetupRow.BillingCycleID);
                fsBillingCycleRow = (FSBillingCycle)billingCycleView.SelectSingle(args.ToArray());

                if (fsBillingCycleRow != null)
                {
                    if (SharedFunctions.IsNotAllowedBillingOptionsModification(fsBillingCycleRow))
                    {
                        fsCustomerBillingSetupRow.SendInvoicesTo     = ID.Send_Invoices_To.BILLING_CUSTOMER_BILL_TO;
                        fsCustomerBillingSetupRow.BillShipmentSource = ID.Ship_To.SERVICE_ORDER_ADDRESS;
                    }
                }
            }
        }
Esempio n. 15
0
        protected virtual void _(Events.FieldUpdated <Customer, FSxCustomer.billingCycleID> e)
        {
            if (e.Row == null)
            {
                return;
            }

            Customer customerRow = (Customer)e.Row;
            PXCache  cache       = e.Cache;

            FSxCustomer fsxCustomerRow = cache.GetExtension <FSxCustomer>(customerRow);

            if (fsxCustomerRow.BillingCycleID == null)
            {
                fsxCustomerRow.SendInvoicesTo = ID.Send_Invoices_To.DEFAULT_BILLING_CUSTOMER_LOCATION;
            }

            ResetSendInvoicesToFromBillingCycle(customerRow, null);
            InsertUpdateCustomerBillingSetup(cache, customerRow, fsxCustomerRow);
        }
        protected virtual void FSCustomerBillingSetup_RowUpdated(PXCache cache, PXRowUpdatedEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            var newCustomerBillingSetup = (FSCustomerBillingSetup)e.Row;
            var oldCustomerBillingSetup = (FSCustomerBillingSetup)e.OldRow;

            if (newCustomerBillingSetup.SrvOrdType != oldCustomerBillingSetup.SrvOrdType ||
                newCustomerBillingSetup.BillingCycleID != oldCustomerBillingSetup.BillingCycleID ||
                newCustomerBillingSetup.FrequencyType != oldCustomerBillingSetup.FrequencyType ||
                newCustomerBillingSetup.Active != oldCustomerBillingSetup.Active)
            {
                FSxCustomer fsxCustomerRow = PXCache <Customer> .GetExtension <FSxCustomer>(Base.BAccount.Current);

                fsxCustomerRow.BillingOptionsChanged = true;
            }
        }
        protected void Customer_RowPersisted(PXCache cache, PXRowPersistedEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            Customer    customerRow    = (Customer)e.Row;
            FSxCustomer fsxCustomerRow = cache.GetExtension <FSxCustomer>(customerRow);

            if (e.Operation == PXDBOperation.Update &&
                e.TranStatus == PXTranStatus.Open &&
                fsxCustomerRow.BillingOptionsChanged == true)
            {
                SharedFunctions.PreUpdateBillingInfoDocs(Base, customerRow.BAccountID, null);
            }

            if (e.TranStatus == PXTranStatus.Completed && fsxCustomerRow.BillingOptionsChanged == true)
            {
                fsxCustomerRow.BillingOptionsChanged = false;
                SharedFunctions.UpdateBillingInfoInDocsLO(Base, customerRow.BAccountID, null);
            }
        }
Esempio n. 18
0
        protected virtual void _(Events.RowPersisting <Customer> e)
        {
            if (e.Row == null)
            {
                return;
            }

            Customer customerRow = (Customer)e.Row;
            PXCache  cache       = e.Cache;

            FSxCustomer fsxCustomerRow = cache.GetExtension <FSxCustomer>(customerRow);

            if (e.Operation == PXDBOperation.Update)
            {
                VerifyPrepaidContractRelated(cache, customerRow, fsxCustomerRow);
            }
            else if (e.Operation == PXDBOperation.Insert)
            {
                if (this.doCopyBillingSettings == false)
                {
                    InsertUpdateCustomerBillingSetup(cache, customerRow, fsxCustomerRow);
                }
            }
        }
        private void VerifyPrepaidContractRelated(PXCache cache, Customer customerRow, FSxCustomer fsxCustomerRow)
        {
            if (fsxCustomerRow.BillingCycleID == (int?)cache.GetValueOriginal <FSxCustomer.billingCycleID>(fsxCustomerRow))
            {
                return;
            }

            if (Setup.Current != null &&
                Setup.Current.CustomerMultipleBillingOptions == false)
            {
                int count = PXSelect <FSServiceOrder,
                                      Where <
                                          FSServiceOrder.billContractPeriodID, IsNotNull,
                                          And <
                                              FSServiceOrder.customerID, Equal <Required <FSServiceOrder.customerID> > > > >
                            .Select(Base, customerRow.BAccountID).Count;

                if (count > 0)
                {
                    cache.RaiseExceptionHandling <FSxCustomer.billingCycleID>(customerRow,
                                                                              fsxCustomerRow.BillingCycleID,
                                                                              new PXSetPropertyException(TX.Error.NO_UPDATE_BILLING_CYCLE_SERVICE_CONTRACT_RELATED, PXErrorLevel.Error));
                    throw new PXException(TX.Error.NO_UPDATE_BILLING_CYCLE_SERVICE_CONTRACT_RELATED);
                }
            }
        }
        protected virtual void FSCustomerBillingSetup_RowPersisting(PXCache cache, PXRowPersistingEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            FSCustomerBillingSetup fsCustomerBillingSetup = (FSCustomerBillingSetup)e.Row;
            FSxCustomer            fsxCustomerRow         = PXCache <Customer> .GetExtension <FSxCustomer>(Base.BAccount.Current);

            if (cache.GetStatus(fsCustomerBillingSetup) == PXEntryStatus.Updated)
            {
                bool insertNewRow = IsCBIDRelatedToPostedDocuments(fsCustomerBillingSetup.CBID);

                if (insertNewRow)
                {
                    fsxCustomerRow.BillingOptionsChanged = true;

                    cache.SetValue <FSCustomerBillingSetup.active>(fsCustomerBillingSetup, false);

                    FSCustomerBillingSetup newCustomerBilingSetupRow = new FSCustomerBillingSetup();
                    var tempFSCustomerBillingSetupCache = new PXCache <FSCustomerBillingSetup>(Base);
                    newCustomerBilingSetupRow.CustomerID = fsCustomerBillingSetup.CustomerID;
                    newCustomerBilingSetupRow.SrvOrdType = fsCustomerBillingSetup.SrvOrdType;
                    newCustomerBilingSetupRow.Active     = true;
                    newCustomerBilingSetupRow            = (FSCustomerBillingSetup)tempFSCustomerBillingSetupCache.Insert(newCustomerBilingSetupRow);

                    foreach (var field in cache.Fields)
                    {
                        if (!cache.Keys.Contains(field) &&
                            field.ToLower() != typeof(FSCustomerBillingSetup.active).Name.ToLower())
                        {
                            tempFSCustomerBillingSetupCache.SetValue(
                                newCustomerBilingSetupRow,
                                field.ToString(),
                                cache.GetValue(
                                    fsCustomerBillingSetup, field.ToString()));
                        }
                    }

                    tempFSCustomerBillingSetupCache.Persist(PXDBOperation.Insert);

                    foreach (var field in cache.Fields)
                    {
                        if (!cache.Keys.Contains(field) &&
                            field.ToLower() != typeof(FSCustomerBillingSetup.active).Name.ToLower())
                        {
                            cache.SetValue(
                                fsCustomerBillingSetup,
                                field.ToString(),
                                cache.GetValueOriginal(
                                    fsCustomerBillingSetup,
                                    field.ToString()));
                        }
                    }

                    cache.SetValue <FSCustomerBillingSetup.active>(fsCustomerBillingSetup, false);
                }
            }

            if (e.Operation == PXDBOperation.Update)
            {
                VerifyPrepaidContractRelated(cache, fsCustomerBillingSetup);
            }
        }
        private void InsertUpdateCustomerBillingSetup(PXCache cache, Customer customerRow, FSxCustomer fsxCustomerRow)
        {
            FSSetup fsSetupRow = PXSelect <FSSetup> .Select(Base);

            if (fsSetupRow != null &&
                fsSetupRow.CustomerMultipleBillingOptions == false)
            {
                FSCustomerBillingSetup fsCustomerBillingSetupRow = CustomerBillingCycles.Select();

                if (fsxCustomerRow.BillingCycleID == null)
                {
                    CustomerBillingCycles.Delete(fsCustomerBillingSetupRow);
                    return;
                }

                if (fsCustomerBillingSetupRow == null)
                {
                    fsCustomerBillingSetupRow            = CustomerBillingCycles.Insert(new FSCustomerBillingSetup());
                    fsCustomerBillingSetupRow.SrvOrdType = null;
                }

                fsCustomerBillingSetupRow.BillingCycleID     = fsxCustomerRow.BillingCycleID;
                fsCustomerBillingSetupRow.SendInvoicesTo     = fsxCustomerRow.SendInvoicesTo;
                fsCustomerBillingSetupRow.BillShipmentSource = fsxCustomerRow.BillShipmentSource;
                fsCustomerBillingSetupRow.FrequencyType      = ID.Frequency_Type.NONE;

                CustomerBillingCycles.Update(fsCustomerBillingSetupRow);
            }
        }
        /// <summary>
        /// Configures the Multiple Services Billing options for the given Customer.
        /// </summary>
        /// <param name="cache">Cache of the view.</param>
        /// <param name="customerRow">Customer row.</param>
        private void DisplayCustomerBillingOptions(PXCache cache, Customer customerRow, FSxCustomer fsxCustomerRow)
        {
            FSSetup fsSetupRow = PXSelect <FSSetup> .Select(Base);

            bool enableMultipleServicesBilling = fsSetupRow != null ? fsSetupRow.CustomerMultipleBillingOptions == true : false;

            PXUIFieldAttribute.SetVisible <FSxCustomer.billingCycleID>(cache, customerRow, !enableMultipleServicesBilling);
            PXUIFieldAttribute.SetVisible <FSxCustomer.sendInvoicesTo>(cache, customerRow, !enableMultipleServicesBilling);
            PXUIFieldAttribute.SetVisible <FSxCustomer.billShipmentSource>(cache, customerRow, !enableMultipleServicesBilling);

            CustomerBillingCycles.AllowSelect = enableMultipleServicesBilling;

            if (fsxCustomerRow != null)
            {
                FSBillingCycle fsBillingCycleRow = PXSelect <FSBillingCycle,
                                                             Where <
                                                                 FSBillingCycle.billingCycleID, Equal <Required <FSBillingCycle.billingCycleID> > > >
                                                   .Select(Base, fsxCustomerRow.BillingCycleID);

                bool forbidUpdateBillingOptions = SharedFunctions.IsNotAllowedBillingOptionsModification(fsBillingCycleRow);

                PXUIFieldAttribute.SetEnabled <FSxCustomer.sendInvoicesTo>(
                    cache,
                    customerRow,
                    forbidUpdateBillingOptions == false);

                PXUIFieldAttribute.SetEnabled <FSxCustomer.billShipmentSource>(
                    cache,
                    customerRow,
                    forbidUpdateBillingOptions == false);

                PXUIFieldAttribute.SetEnabled <FSxCustomer.billingCycleID>(
                    cache,
                    customerRow);
            }
        }
        private void EnableDisableCustomerBilling(PXCache cache, Customer customerRow, FSxCustomer fsxCustomerRow)
        {
            bool isSpecificCustomer = fsxCustomerRow.DefaultBillingCustomerSource == ID.Default_Billing_Customer_Source.SPECIFIC_CUSTOMER;

            PXUIFieldAttribute.SetVisible <FSxCustomer.billCustomerID>(cache, customerRow, isSpecificCustomer);
            PXUIFieldAttribute.SetVisible <FSxCustomer.billLocationID>(cache, customerRow, isSpecificCustomer);
            PXDefaultAttribute.SetPersistingCheck <FSxCustomer.billCustomerID>(cache, customerRow, isSpecificCustomer == true ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing);
            PXDefaultAttribute.SetPersistingCheck <FSxCustomer.billLocationID>(cache, customerRow, isSpecificCustomer == true ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing);

            if (isSpecificCustomer == false)
            {
                fsxCustomerRow.BillCustomerID = null;
                fsxCustomerRow.BillLocationID = null;
            }
        }