/// <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> public virtual 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 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); } } }
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; } } } }
protected virtual void _(Events.RowSelected <FSCustomerClassBillingSetup> e) { if (e.Row == null) { return; } FSCustomerClassBillingSetup fsCustomerClassBillingSetupRow = (FSCustomerClassBillingSetup)e.Row; PXCache cache = e.Cache; if (!IsThisLineValid(fsCustomerClassBillingSetupRow)) { PXUIFieldAttribute.SetEnabled <FSCustomerClassBillingSetup.billingCycleID>(cache, fsCustomerClassBillingSetupRow, false); PXUIFieldAttribute.SetEnabled <FSCustomerClassBillingSetup.sendInvoicesTo>(cache, fsCustomerClassBillingSetupRow, false); PXUIFieldAttribute.SetEnabled <FSCustomerClassBillingSetup.billShipmentSource>(cache, fsCustomerClassBillingSetupRow, false); PXUIFieldAttribute.SetEnabled <FSCustomerClassBillingSetup.frequencyType>(cache, fsCustomerClassBillingSetupRow, false); return; } bool enableBillingCycleIDField = fsCustomerClassBillingSetupRow.BillingCycleID == null && string.IsNullOrEmpty(fsCustomerClassBillingSetupRow.SrvOrdType) == false; PXUIFieldAttribute.SetEnabled <FSCustomerBillingSetup.billingCycleID>(cache, fsCustomerClassBillingSetupRow, enableBillingCycleIDField); //Disables the TimeCycleType field if the type of the BillingCycleID selected is Time Cycle. if (fsCustomerClassBillingSetupRow.BillingCycleID != null) { FSBillingCycle fsBillingCycleRow = PXSelect <FSBillingCycle, Where < FSBillingCycle.billingCycleID, Equal <Required <FSBillingCycle.billingCycleID> > > > .Select(Base, fsCustomerClassBillingSetupRow.BillingCycleID); PXUIFieldAttribute.SetEnabled <FSCustomerClassBillingSetup.frequencyType>(cache, fsCustomerClassBillingSetupRow, fsBillingCycleRow.BillingCycleType != ID.Billing_Cycle_Type.TIME_FRAME); bool forbidUpdateBillingOptions = SharedFunctions.IsNotAllowedBillingOptionsModification(fsBillingCycleRow); PXUIFieldAttribute.SetEnabled <FSCustomerClassBillingSetup.sendInvoicesTo>(cache, fsCustomerClassBillingSetupRow, forbidUpdateBillingOptions == false); PXUIFieldAttribute.SetEnabled <FSCustomerClassBillingSetup.billShipmentSource>(cache, fsCustomerClassBillingSetupRow, forbidUpdateBillingOptions == false); } else { PXUIFieldAttribute.SetEnabled <FSCustomerClassBillingSetup.frequencyType>(cache, fsCustomerClassBillingSetupRow, false); } }
protected void FSCustomerBillingSetup_RowSelected(PXCache cache, PXRowSelectedEventArgs e) { if (e.Row == null) { return; } FSCustomerBillingSetup fsCustomerBillingSetupRow = (FSCustomerBillingSetup)e.Row; bool lineValid = IsThisLineValid(fsCustomerBillingSetupRow); PXUIFieldAttribute.SetEnabled <FSCustomerBillingSetup.billingCycleID>(cache, fsCustomerBillingSetupRow, lineValid); PXUIFieldAttribute.SetEnabled <FSCustomerBillingSetup.sendInvoicesTo>(cache, fsCustomerBillingSetupRow, lineValid); PXUIFieldAttribute.SetEnabled <FSCustomerBillingSetup.billShipmentSource>(cache, fsCustomerBillingSetupRow, lineValid); PXUIFieldAttribute.SetEnabled <FSCustomerBillingSetup.frequencyType>(cache, fsCustomerBillingSetupRow, lineValid); bool enableFieldsBySrvOrdType = string.IsNullOrEmpty(fsCustomerBillingSetupRow.SrvOrdType) == false; bool enableSrvOrdType = !enableFieldsBySrvOrdType || cache.GetStatus(fsCustomerBillingSetupRow) == PXEntryStatus.Inserted; PXUIFieldAttribute.SetEnabled <FSCustomerBillingSetup.srvOrdType>(cache, fsCustomerBillingSetupRow, enableSrvOrdType); PXUIFieldAttribute.SetEnabled <FSCustomerBillingSetup.billingCycleID>(cache, fsCustomerBillingSetupRow, enableFieldsBySrvOrdType); //Disables the TimeCycleType field if the type of the BillingCycleID selected is Time Cycle. if (fsCustomerBillingSetupRow.BillingCycleID != null) { FSBillingCycle fsBillingCycleRow = PXSelect <FSBillingCycle, Where < FSBillingCycle.billingCycleID, Equal <Required <FSBillingCycle.billingCycleID> > > > .Select(Base, fsCustomerBillingSetupRow.BillingCycleID); PXUIFieldAttribute.SetEnabled <FSCustomerBillingSetup.frequencyType>(cache, fsCustomerBillingSetupRow, fsBillingCycleRow.BillingCycleType != ID.Billing_Cycle_Type.TIME_FRAME); bool forbidUpdateBillingOptions = SharedFunctions.IsNotAllowedBillingOptionsModification(fsBillingCycleRow); PXUIFieldAttribute.SetEnabled <FSCustomerBillingSetup.sendInvoicesTo>(cache, fsCustomerBillingSetupRow, forbidUpdateBillingOptions == false); PXUIFieldAttribute.SetEnabled <FSCustomerBillingSetup.billShipmentSource>(cache, fsCustomerBillingSetupRow, forbidUpdateBillingOptions == false); } else { PXUIFieldAttribute.SetEnabled <FSCustomerBillingSetup.frequencyType>(cache, fsCustomerBillingSetupRow, false); } }
protected virtual void VerifyIsAlreadyPosted <Field>(PXCache cache, FSAppointmentDet fsAppointmentDetRow, FSAppointmentInventoryItem fsAppointmentInventoryItemRow, FSBillingCycle billingCycleRow) where Field : class, IBqlField { if ((fsAppointmentDetRow == null && fsAppointmentInventoryItemRow == null) || ServiceOrderRelated.Current == null || billingCycleRow == null) { return; } IFSSODetBase row = null; int? pivot = -1; if (fsAppointmentDetRow != null) { row = fsAppointmentDetRow; pivot = fsAppointmentDetRow.SODetID; } else if (fsAppointmentInventoryItemRow != null) { row = fsAppointmentInventoryItemRow; pivot = fsAppointmentInventoryItemRow.AppDetID > 0 ? fsAppointmentInventoryItemRow.AppDetID : null; } PXEntryStatus status = ServiceOrderRelated.Cache.GetStatus(ServiceOrderRelated.Current); bool needsVerify = status == PXEntryStatus.Updated || status == PXEntryStatus.Notchanged; bool isSOAlreadyPosted = ServiceOrderPostedIn.Select().Count > 0; if (needsVerify == true && pivot == null && IsInstructionOrComment(row) == false && billingCycleRow.BillingBy == ID.Billing_By.SERVICE_ORDER && isSOAlreadyPosted == true) { cache.RaiseExceptionHandling <Field>(row, row.InventoryID, new PXSetPropertyException( PXMessages.LocalizeFormat(TX.Error.CANNOT_ADD_INVENTORY_TYPE_LINES_BECAUSE_SO_POSTED, GetLineType(row.LineType)), PXErrorLevel.RowError)); } }