protected void FSCustomerClassBillingSetup_BillingCycleID_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e) { if (e.Row == null) { return; } FSCustomerClassBillingSetup fsCustomerClassBillingSetupRow = (FSCustomerClassBillingSetup)e.Row; this.ResetSendInvoicesToFromBillingCycle(null, fsCustomerClassBillingSetupRow); }
protected virtual void _(Events.FieldUpdated <FSCustomerClassBillingSetup, FSCustomerClassBillingSetup.billingCycleID> e) { if (e.Row == null) { return; } FSCustomerClassBillingSetup fsCustomerClassBillingSetupRow = (FSCustomerClassBillingSetup)e.Row; this.ResetSendInvoicesToFromBillingCycle(null, fsCustomerClassBillingSetupRow); }
private bool IsThisLineValid(FSCustomerClassBillingSetup fsCustomerClassBillingSetupRow_Current) { int count = 0; foreach (FSCustomerClassBillingSetup fsCustomerClassBillingRow in BillingCycles.Select()) { if (fsCustomerClassBillingSetupRow_Current.SrvOrdType != null && fsCustomerClassBillingSetupRow_Current.SrvOrdType.Equals(fsCustomerClassBillingRow.SrvOrdType)) { count++; } } return(count <= 1); }
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); } }
private 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; } } } }