protected virtual void CRCase_SDEnabled_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e) { if (e.Row == null) { return; } CRCase crCaseRow = (CRCase)e.Row; FSxCRCase fsxCRCaseRow = cache.GetExtension <FSxCRCase>(crCaseRow); if (fsxCRCaseRow.SDEnabled == true) { FSSetup fsSetupRow = GetFSSetup(); if (fsSetupRow != null && fsSetupRow.DfltCasesSrvOrdType != null) { fsxCRCaseRow.SrvOrdType = fsSetupRow.DfltCasesSrvOrdType; } SetBranchLocationID(Base, fsxCRCaseRow); } else { fsxCRCaseRow.SrvOrdType = null; fsxCRCaseRow.BranchLocationID = null; } }
/// <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); } }
/// <summary> /// Enable or Disable fields. /// </summary> public virtual void EnableDisable(PXCache cache, InventoryItem inventoryItemRow) { if (inventoryItemRow == null) { return; } FSSetup fsSetupRow = PXSelect <FSSetup> .Select(Base); var enabled = inventoryItemRow.ItemType == INItemTypes.ServiceItem; PXUIFieldAttribute.SetEnabled <FSxService.billingRule>(cache, inventoryItemRow, enabled); PXUIFieldAttribute.SetEnabled <FSxService.estimatedDuration>(cache, inventoryItemRow, enabled); ServiceSkills.Cache.AllowInsert = enabled; ServiceSkills.Cache.AllowDelete = enabled; ServiceSkills.Cache.AllowUpdate = enabled; ServiceLicenseTypes.Cache.AllowInsert = enabled; ServiceLicenseTypes.Cache.AllowDelete = enabled; ServiceLicenseTypes.Cache.AllowUpdate = enabled; ServiceEquipmentTypes.Cache.AllowInsert = enabled; ServiceEquipmentTypes.Cache.AllowDelete = enabled; ServiceEquipmentTypes.Cache.AllowUpdate = enabled; if (fsSetupRow != null) { bool activateEarningType = (bool)fsSetupRow.EnableEmpTimeCardIntegration; PXUIFieldAttribute.SetEnabled <FSxService.dfltEarningType>(cache, inventoryItemRow, activateEarningType); } }
/// <summary> /// Try to get the appropriate ServiceOrderType from this sources: /// a. <c>FSServiceOrder</c> /// b. <c>FSWrkProcessRow</c> /// c. <c>FSSetup</c> /// </summary> /// <param name="fsWrkProcessRow"><c>FSWrkProcess</c> row.</param> /// <param name="fsServiceOrderRow">FSServiceOrder row.</param> private string GetSrvOrdType(FSWrkProcess fsWrkProcessRow, FSServiceOrder fsServiceOrderRow) { // a) Try to retrieve the ServiceOrderType from the ServiceOrder row if (fsWrkProcessRow.SOID != null && fsServiceOrderRow != null && !string.IsNullOrEmpty(fsServiceOrderRow.SrvOrdType)) { return(fsServiceOrderRow.SrvOrdType); } // b) Try to retrieve the ServiceOrderType from the WrkProcess row if (!string.IsNullOrEmpty(fsWrkProcessRow.SrvOrdType) && !string.IsNullOrWhiteSpace(fsWrkProcessRow.SrvOrdType)) { return(fsWrkProcessRow.SrvOrdType); } // c) Try to retrieve the Default ServiceOrderType from the Setup row FSSetup fsSetupRow = PXSetup <FSSetup> .Select(this); if (fsSetupRow != null && !string.IsNullOrEmpty(fsSetupRow.DfltSrvOrdType)) { return(fsSetupRow.DfltSrvOrdType); } return(null); }
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); } }
public virtual void EnableDisable_Document(PXCache cache, FSSetup fsSetupRow) { PXDefaultAttribute.SetPersistingCheck <FSSetup.contractPostOrderType>(cache, fsSetupRow, PXPersistingCheck.Nothing); PXDefaultAttribute.SetPersistingCheck <FSSetup.dfltContractTermIDARSO>(cache, fsSetupRow, PXPersistingCheck.Nothing); PXUIFieldAttribute.SetEnabled <FSSetup.rOLunchBreakEndTimeFrame>(cache, fsSetupRow, fsSetupRow.ROLunchBreakDuration != null); PXUIFieldAttribute.SetEnabled <FSSetup.rOLunchBreakStartTimeFrame>(cache, fsSetupRow, fsSetupRow.ROLunchBreakDuration != null); }
public static IInvoiceContractGraph GetInvoiceGraph(FSSetup fsSetupRow) { if (fsSetupRow.ContractPostTo == ID.Batch_PostTo.SO) { if (PXAccess.FeatureInstalled <FeaturesSet.distributionModule>()) { return(PXGraph.CreateInstance <SOOrderEntry>().GetExtension <SM_SOOrderEntry>()); } else { throw new PXException(TX.Error.DISTRIBUTION_MODULE_IS_DISABLED); } } else if (fsSetupRow.ContractPostTo == ID.Batch_PostTo.AR) { return(PXGraph.CreateInstance <ARInvoiceEntry>().GetExtension <SM_ARInvoiceEntry>()); } else if (fsSetupRow.ContractPostTo == ID.Batch_PostTo.SI) { throw new PXSetPropertyException(TX.Error.SOINVOICE_FROM_CONTRACT_NOT_IMPLEMENTED_CHANGE_IN_X_OR_Y, PXErrorLevel.Error, DACHelper.GetDisplayName(typeof(FSEquipmentSetup)), DACHelper.GetDisplayName(typeof(FSRouteSetup))); } return(null); }
protected virtual void _(Events.FieldUpdated <CROpportunity, FSxCROpportunity.sDEnabled> e) { if (e.Row == null) { return; } CROpportunity crOpportunityRow = (CROpportunity)e.Row; FSxCROpportunity fsxCROpportunityRow = e.Cache.GetExtension <FSxCROpportunity>(crOpportunityRow); if (fsxCROpportunityRow.SDEnabled == true) { FSSetup fsSetupRow = GetFSSetup(); if (fsSetupRow != null && fsSetupRow.DfltOpportunitySrvOrdType != null) { fsxCROpportunityRow.SrvOrdType = fsSetupRow.DfltOpportunitySrvOrdType; } SetBranchLocationID(Base, crOpportunityRow, fsxCROpportunityRow); Base.Opportunity.SetValueExt <CROpportunity.allowOverrideContactAddress>(crOpportunityRow, true); } else { fsxCROpportunityRow.BranchLocationID = null; } }
public static void EnableDisable_Document(PXCache cache, FSSetup fsSetupRow) { bool isDistributionModuleInstalled = PXAccess.FeatureInstalled <FeaturesSet.distributionModule>(); PXDefaultAttribute.SetPersistingCheck <FSSetup.contractPostOrderType>(cache, fsSetupRow, PXPersistingCheck.Nothing); PXDefaultAttribute.SetPersistingCheck <FSSetup.dfltContractTermIDARSO>(cache, fsSetupRow, PXPersistingCheck.Nothing); }
public RouteSetupMaint() : base() { FSSetup setup = PXSelectReadonly <FSSetup> .Select(this); if (setup == null) { throw new PXSetupNotEnteredException(ErrorMessages.SetupNotEntered, typeof(FSSetup), DACHelper.GetDisplayName(typeof(FSSetup))); } }
public EquipmentSetupMaint() : base() { FSSetup setup = PXSelectReadonly <FSSetup> .Select(this); if (setup == null) { throw new PXSetupNotEnteredException(ErrorMessages.SetupNotEntered, typeof(FSSetup), PXMessages.LocalizeNoPrefix(TX.ScreenName.SERVICE_PREFERENCES)); } }
protected virtual void FSSetup_RowPersisting(PXCache cache, PXRowPersistingEventArgs e) { if (e.Row == null) { return; } FSSetup fsSetupRow = (FSSetup)e.Row; Update_SrvOrdType_TimeActivitiesFromAppointment(this, fsSetupRow.EnableEmpTimeCardIntegration); }
protected virtual void FSSetup_RowInserted(PXCache cache, PXRowInsertedEventArgs e) { if (e.Row == null) { return; } FSSetup fsSetupRow = (FSSetup)e.Row; fsSetupRow.BillingOptionsChanged = true; }
public virtual Waypoint GetWaypointFromAppointment(FSSetup fsSetupRow, FSAppointment fsAppointmentRow, string address) { Waypoint wp = new Waypoint(); GLocation[] results; if (fsAppointmentRow.MapLatitude == null || fsAppointmentRow.MapLongitude == null) { results = Geocoder.Geocode(address, fsSetupRow.MapApiKey); if (results.Length > 0) { fsAppointmentRow.MapLatitude = (decimal)results[0].LatLng.Latitude; fsAppointmentRow.MapLongitude = (decimal)results[0].LatLng.Longitude; } } if (fsAppointmentRow.MapLatitude != null && fsAppointmentRow.MapLongitude != null) { if (fsAppointmentRow.Confirmed == true && fsAppointmentRow.ScheduledDateTimeBegin.HasValue) { TimeWindow tm = new TimeWindow(); wp.timeWindows = new List <TimeWindow>(); tm.startTimeSec = (int)fsAppointmentRow.ScheduledDateTimeBegin.Value.TimeOfDay.TotalSeconds; tm.stopTimeSec = (int)fsAppointmentRow.ScheduledDateTimeBegin.Value.TimeOfDay.TotalSeconds; wp.timeWindows.Add(tm); } wp.name = fsAppointmentRow.AppointmentID.ToString(); wp.serviceTimeSec = (int)((fsAppointmentRow.ScheduledDateTimeEnd - fsAppointmentRow.ScheduledDateTimeBegin).Value.TotalSeconds); wp.location = new RouteLocation() { latitude = (double)fsAppointmentRow.MapLatitude, longitude = (double)fsAppointmentRow.MapLongitude }; if (fsAppointmentRow.PrimaryDriver != null) { wp.tagsIncludeAnd = new List <string>() { fsAppointmentRow.PrimaryDriver.ToString() }; wp.priority = 99; } } else { return(null); } return(wp); }
/// <summary> /// Return if ManageAttendees is active or inactive on the Service Management. /// </summary> public static bool IsAttendeesManagementActive(PXGraph graph, FSSetup fsSetup = null) { FSSetup fsSetupRow = fsSetup == null?GetServiceManagementSetup(graph) : fsSetup; if (fsSetupRow != null && IsRoomManagementActive(graph, fsSetupRow)) { return((bool)fsSetupRow.ManageAttendees); } return(false); }
protected virtual void _(Events.RowInserted <FSSetup> e) { if (e.Row == null) { return; } FSSetup fsSetupRow = (FSSetup)e.Row; fsSetupRow.BillingOptionsChanged = true; }
protected virtual void _(Events.RowPersisting <FSSetup> e) { if (e.Row == null) { return; } FSSetup fsSetupRow = (FSSetup)e.Row; Update_SrvOrdType_TimeActivitiesFromAppointment(this, fsSetupRow.EnableEmpTimeCardIntegration); }
public virtual void FSSetup_RowSelected(PXCache cache, PXRowSelectedEventArgs e) { if (e.Row == null) { return; } FSSetup fsSetupRow = (FSSetup)e.Row; EnableDisable_Document(cache, fsSetupRow); }
protected virtual void _(Events.RowSelected <FSSetup> e) { if (e.Row == null) { return; } FSSetup fsSetupRow = (FSSetup)e.Row; EnableDisable_Document(e.Cache, fsSetupRow); }
protected virtual void _(Events.FieldDefaulting <FSSrvOrdType, FSSrvOrdType.appAddressSource> e) { //The default value for this field cannot be handled in the DAC with the PXDefault attribute //because the information is retrieved from FSSetup and it fails when the setup hasn't been configured if (e.Row == null) { return; } FSSetup fsSetupRow = SetupRecord.Select(); e.NewValue = ID.Source_Info.BUSINESS_ACCOUNT; }
protected virtual void _(Events.RowSelected <FSSetup> e) { if (e.Row == null) { return; } FSSetup fsSetupRow = (FSSetup)e.Row; PXCache cache = e.Cache; EquipmentSetupMaint.EnableDisable_Document(cache, fsSetupRow); SharedFunctions.ValidatePostToByFeatures <FSSetup.contractPostTo>(cache, fsSetupRow, fsSetupRow.ContractPostTo); FSPostTo.SetLineTypeList <FSSetup.contractPostTo>(e.Cache, e.Row); }
protected virtual void _(Events.FieldUpdated <FSSetup, FSSetup.contractPostTo> e) { if (e.Row == null) { return; } FSSetup fsSetupRow = (FSSetup)e.Row; if (fsSetupRow.ContractPostTo != (string)e.OldValue) { SharedFunctions.ValidatePostToByFeatures <FSSetup.contractPostTo>(e.Cache, fsSetupRow, fsSetupRow.ContractPostTo); } }
public override void Initialize() { FSSetup fsSetupRow = this.SetupRecord.Select(); if (fsSetupRow != null) { bool enableEmpTimeCardIntegration = (bool)fsSetupRow.EnableEmpTimeCardIntegration; PXUIFieldAttribute.SetVisible <FSxPMTimeActivity.appointmentID>(Base.Activity.Cache, Base.Activity.Current, enableEmpTimeCardIntegration); PXUIFieldAttribute.SetVisible <FSxPMTimeActivity.appointmentCustomerID>(Base.Activity.Cache, Base.Activity.Current, enableEmpTimeCardIntegration); PXUIFieldAttribute.SetVisible <FSxPMTimeActivity.sOID>(Base.Activity.Cache, Base.Activity.Current, enableEmpTimeCardIntegration); PXUIFieldAttribute.SetVisible <FSxPMTimeActivity.appEmpID>(Base.Activity.Cache, Base.Activity.Current, enableEmpTimeCardIntegration); PXUIFieldAttribute.SetVisible <FSxPMTimeActivity.serviceID>(Base.Activity.Cache, Base.Activity.Current, enableEmpTimeCardIntegration); } }
/// <summary> /// Return if ManageRooms is active or inactive on the Service Management. /// </summary> public static bool IsRoomManagementActive(PXGraph graph, FSSetup fsSetupRow = null) { if (fsSetupRow == null) { fsSetupRow = GetServiceManagementSetup(graph); } if (fsSetupRow != null) { return((bool)fsSetupRow.ManageRooms); } return(false); }
public static void EnableDisable_Document(PXCache cache, FSSetup fsSetupRow) { bool isDistributionModuleInstalled = PXAccess.FeatureInstalled <FeaturesSet.distributionModule>(); PXUIFieldAttribute.SetVisible <FSSetup.contractPostOrderType>(cache, fsSetupRow, isDistributionModuleInstalled && fsSetupRow.ContractPostTo == ID.SrvOrdType_PostTo.SALES_ORDER_MODULE); if (fsSetupRow.ContractPostTo == ID.SrvOrdType_PostTo.SALES_ORDER_MODULE) { PXDefaultAttribute.SetPersistingCheck <FSSetup.contractPostOrderType>(cache, fsSetupRow, PXPersistingCheck.NullOrBlank); } else { PXDefaultAttribute.SetPersistingCheck <FSSetup.contractPostOrderType>(cache, fsSetupRow, PXPersistingCheck.Nothing); } }
public virtual Break GetBreakWindow(FSSetup fsSetupRow) { Break lunchBreak = null; if (fsSetupRow.ROLunchBreakDuration > 0) { lunchBreak = new Break(); lunchBreak.durationSec = fsSetupRow.ROLunchBreakDuration.Value * 60; lunchBreak.startTimeSec = (int)fsSetupRow.ROLunchBreakStartTimeFrame.Value.TimeOfDay.TotalSeconds; lunchBreak.stopTimeSec = (int)fsSetupRow.ROLunchBreakEndTimeFrame.Value.TimeOfDay.TotalSeconds - lunchBreak.durationSec; } return(lunchBreak); }
protected virtual void _(Events.FieldUpdated <FSSetup, FSSetup.customerMultipleBillingOptions> e) { if (e.Row == null) { return; } FSSetup fsSetupRow = (FSSetup)e.Row; fsSetupRow.BillingOptionsChanged = true; e.Cache.RaiseExceptionHandling <FSSetup.customerMultipleBillingOptions>(fsSetupRow, fsSetupRow.CustomerMultipleBillingOptions, new PXSetPropertyException(TX.Warning.CUSTOMER_MULTIPLE_BILLING_OPTIONS_CHANGING, PXErrorLevel.Warning)); }
public virtual void UpdateSourcePostDoc(FSSetup fsSetupRow, FSContractPostDoc fsContractPostDocRow, FSServiceContract fsServiceContractRow) { if (fsServiceContractRow.RecordType == ID.RecordType_ServiceContract.SERVICE_CONTRACT) { ServiceContractEntry ServiceContractGraph = PXGraph.CreateInstance <ServiceContractEntry>(); ServiceContractGraph.ServiceContractRecords.Current = ServiceContractGraph.ServiceContractRecords.Search <FSServiceContract.serviceContractID>(fsContractPostDocRow.ServiceContractID, fsServiceContractRow.CustomerID); ServiceContractGraph.InvoiceBillingPeriod(fsSetupRow, fsContractPostDocRow); } else { RouteServiceContractEntry RouteServiceContractGraph = PXGraph.CreateInstance <RouteServiceContractEntry>(); RouteServiceContractGraph.ServiceContractRecords.Current = RouteServiceContractGraph.ServiceContractRecords.Search <FSServiceContract.serviceContractID>(fsContractPostDocRow.ServiceContractID, fsServiceContractRow.CustomerID); RouteServiceContractGraph.InvoiceBillingPeriod(fsSetupRow, fsContractPostDocRow); } }
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); } } }
protected virtual void _(Events.FieldUpdated <FSSetup, FSSetup.appAutoConfirmGap> e) { if (e.Row == null) { return; } FSSetup fsSetupRow = (FSSetup)e.Row; if (fsSetupRow.AppAutoConfirmGap < 0) { e.Cache.RaiseExceptionHandling <FSSetup.appAutoConfirmGap>(fsSetupRow, fsSetupRow.AppAutoConfirmGap, new PXSetPropertyException(PXMessages.LocalizeFormatNoPrefix(TX.Error.MINIMUN_VALUE, " 00 h 00 m"), PXErrorLevel.Error)); } }