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;
            }
        }
        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;
        }
Example #3
0
        protected void CustomerClass_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            CustomerClass    customerClassRow    = (CustomerClass)e.Row;
            FSxCustomerClass fsxCustomerClassRow = cache.GetExtension <FSxCustomerClass>(customerClassRow);

            this.DisplayBillingOptions(cache, customerClassRow, fsxCustomerClassRow);
            EnableDisableCustomerBilling(cache, customerClassRow, fsxCustomerClassRow);
        }
Example #4
0
        protected virtual void _(Events.RowSelected <CustomerClass> e)
        {
            if (e.Row == null)
            {
                return;
            }

            CustomerClass customerClassRow = (CustomerClass)e.Row;
            PXCache       cache            = e.Cache;

            FSxCustomerClass fsxCustomerClassRow = cache.GetExtension <FSxCustomerClass>(customerClassRow);

            this.DisplayBillingOptions(cache, customerClassRow, fsxCustomerClassRow);
            EnableDisableCustomerBilling(cache, customerClassRow, fsxCustomerClassRow);
        }
Example #5
0
        public virtual void ResetSendInvoicesToFromBillingCycle(CustomerClass customerClassRow, FSCustomerClassBillingSetup fsCustomerClassBillingSetupRow)
        {
            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 (customerClassRow != null)
            {
                FSxCustomerClass fsxCustomerClassRow = PXCache <CustomerClass> .GetExtension <FSxCustomerClass>(customerClassRow);

                args.Add(fsxCustomerClassRow.DfltBillingCycleID);

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

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

                if (fsBillingCycleRow != null)
                {
                    if (SharedFunctions.IsNotAllowedBillingOptionsModification(fsBillingCycleRow))
                    {
                        fsCustomerClassBillingSetupRow.SendInvoicesTo     = ID.Send_Invoices_To.BILLING_CUSTOMER_BILL_TO;
                        fsCustomerClassBillingSetupRow.BillShipmentSource = ID.Ship_To.SERVICE_ORDER_ADDRESS;
                    }
                }
            }
        }
Example #6
0
        private void DisplayBillingOptions(PXCache cache, CustomerClass customerClassRow, FSxCustomerClass fsxCustomerClassRow)
        {
            FSSetup fsSetupRow = PXSelect <FSSetup> .Select(Base);

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

            PXUIFieldAttribute.SetVisible <FSxCustomerClass.dfltBillingCycleID>(cache, customerClassRow, !enableMultipleServicesBilling);
            PXUIFieldAttribute.SetVisible <FSxCustomerClass.sendInvoicesTo>(cache, customerClassRow, !enableMultipleServicesBilling);
            PXUIFieldAttribute.SetVisible <FSxCustomerClass.billShipmentSource>(cache, customerClassRow, !enableMultipleServicesBilling);

            BillingCycles.AllowSelect = enableMultipleServicesBilling;

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

                bool forbidUpdateBillingOptions = SharedFunctions.IsNotAllowedBillingOptionsModification(fsBillingCycleRow);

                PXUIFieldAttribute.SetEnabled <FSxCustomerClass.sendInvoicesTo>(
                    cache,
                    customerClassRow,
                    forbidUpdateBillingOptions == false);

                PXUIFieldAttribute.SetEnabled <FSxCustomerClass.billShipmentSource>(
                    cache,
                    customerClassRow,
                    forbidUpdateBillingOptions == false);

                PXUIFieldAttribute.SetEnabled <FSxCustomerClass.dfltBillingCycleID>(
                    cache,
                    customerClassRow);

                if (fsxCustomerClassRow.DfltBillingCycleID != null &&
                    forbidUpdateBillingOptions == false)
                {
                    PXDefaultAttribute.SetPersistingCheck <FSxCustomerClass.sendInvoicesTo>(cache, customerClassRow, PXPersistingCheck.NullOrBlank);
                    PXDefaultAttribute.SetPersistingCheck <FSxCustomerClass.billShipmentSource>(cache, customerClassRow, PXPersistingCheck.NullOrBlank);
                }
                else
                {
                    PXDefaultAttribute.SetPersistingCheck <FSxCustomerClass.sendInvoicesTo>(cache, customerClassRow, PXPersistingCheck.Nothing);
                    PXDefaultAttribute.SetPersistingCheck <FSxCustomerClass.billShipmentSource>(cache, customerClassRow, PXPersistingCheck.Nothing);
                }
            }
        }
Example #7
0
        private void EnableDisableCustomerBilling(PXCache cache, CustomerClass customerClassRow, FSxCustomerClass fsxCustomerClassRow)
        {
            bool isSpecificCustomer = fsxCustomerClassRow.DefaultBillingCustomerSource == ID.Default_Billing_Customer_Source.SPECIFIC_CUSTOMER;

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

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