protected virtual IEnumerable Cancel(PXAdapter adapter) { BAccountLocation bAccountLocationRow = LocationRecords.Current; if (bAccountLocationRow != null && bAccountLocationRow.CustomerID != null && adapter.Searches.Length == 2 && adapter.Searches[0] != null) { if (bAccountLocationRow.CustomerCD.Trim() != adapter.Searches[0].ToString().Trim()) { PXResult <BAccount, Location> BaccountLocationResultSet = (PXResult <BAccount, Location>) PXSelectJoin <BAccount, InnerJoin <Location, On < Location.bAccountID, Equal <BAccount.bAccountID> > >, Where < BAccount.acctCD, Equal <Required <BAccount.acctCD> > > > .SelectWindowed(this, 0, 1, adapter.Searches[0]); Location locationRow = BaccountLocationResultSet; adapter.Searches[1] = locationRow.LocationCD; } } foreach (BAccountLocation loc in (new PXCancel <BAccountLocation>(this, "Cancel")).Press(adapter)) { return(new object[] { loc }); } return(new object[0]); }
public static bool IsWorkDay(PXGraph graph, string CalendarID, DateTime Date) { PXResult <CSCalendar, CSCalendarExceptions> result = (PXResult <CSCalendar, CSCalendarExceptions>) PXSelectJoin < CSCalendar , LeftJoin <CSCalendarExceptions , On <CSCalendarExceptions.calendarID, Equal <CSCalendar.calendarID>, And <CSCalendarExceptions.date, Equal <Required <CSCalendarExceptions.date> > > > > , Where <CSCalendar.calendarID, Equal <Required <CSCalendar.calendarID> > > > .SelectWindowed(graph, 0, 1, Date, CalendarID); if (result != null) { CSCalendar calendar = result; CSCalendarExceptions exc = result; if (exc.Date != null) { return(exc.WorkDay == true); } else { return(calendar.IsWorkDay(Date)); } } return(true); }
public static void GetManagePaymentProfileForm(PXGraph graph, ICCPaymentProfile paymentProfile) { if (graph == null || paymentProfile == null) { return; } CustomerPaymentMethodDetail ccpID = PXSelectJoin <CustomerPaymentMethodDetail, InnerJoin <PaymentMethodDetail, On <CustomerPaymentMethodDetail.paymentMethodID, Equal <PaymentMethodDetail.paymentMethodID>, And <CustomerPaymentMethodDetail.detailID, Equal <PaymentMethodDetail.detailID>, And <PaymentMethodDetail.useFor, Equal <PaymentMethodDetailUsage.useForARCards> > > > >, Where <PaymentMethodDetail.isCCProcessingID, Equal <True>, And <CustomerPaymentMethodDetail.pMInstanceID, Equal <Required <CustomerPaymentMethod.pMInstanceID> > > > > .SelectWindowed(graph, 0, 1, paymentProfile.PMInstanceID); if (ccpID != null && !string.IsNullOrEmpty(ccpID.Value)) { ProcessingCardsPluginFactory pluginFactory = GetProcessingCardsPluginFactory(paymentProfile.CCProcessingCenterID); CCCustomerInformationManager cim = GetCustomerInformationManager(pluginFactory); CCProcessingCenter processingCenter = pluginFactory.GetProcessingCenter(); CCProcessingContext context = new CCProcessingContext() { processingCenter = pluginFactory.GetProcessingCenter(), aCustomerID = paymentProfile.BAccountID, aPMInstanceID = paymentProfile.PMInstanceID, callerGraph = graph }; CardProcessingReadersProvider readersProvider = new CardProcessingReadersProvider(context); cim.SetReadersProvider(readersProvider); cim.GetManagePaymentProfileForm(); } }
protected override void ClosePeriodProc(FinPeriod financialPeriod) { PXSelectBase <APRegister> prebookedDocuments = new PXSelect < APRegister, Where < APRegister.voided, Equal <False>, And <APRegister.prebooked, Equal <True>, And <APRegister.released, Equal <False>, And <APRegister.finPeriodID, Equal <Required <APRegister.finPeriodID> > > > > > >(this); if (prebookedDocuments.Any(financialPeriod.FinPeriodID)) { throw new PXException(Messages.PeriodHasPrebookedDocs); } PXSelectBase <APRegister> unreleasedDocuments = new PXSelectJoin < APRegister, LeftJoin <APAdjust, On <APAdjust.adjgDocType, Equal <APRegister.docType>, And <APAdjust.adjgRefNbr, Equal <APRegister.refNbr>, And <APAdjust.released, Equal <False> > > > >, Where < APRegister.voided, Equal <False>, And <APRegister.scheduled, Equal <False>, And <APRegister.rejected, Equal <False>, And <Where < APAdjust.adjgFinPeriodID, IsNull, And <APRegister.released, Equal <False>, And <APRegister.finPeriodID, Equal <Required <APRegister.finPeriodID> >, Or <APAdjust.adjgFinPeriodID, Equal <Required <APAdjust.adjgFinPeriodID> > > > > > > > > > >(this); if (unreleasedDocuments.Any(financialPeriod.FinPeriodID, financialPeriod.FinPeriodID)) { throw new PXException(Messages.PeriodHasUnreleasedDocs); } LandedCostTran landedCostTransactions = PXSelectJoin < LandedCostTran, InnerJoin <POReceipt, On <LandedCostTran.pOReceiptNbr, Equal <POReceipt.receiptNbr> > >, Where < LandedCostTran.source, Equal <LandedCostTranSource.fromPO>, And <POReceipt.released, Equal <True>, And <LandedCostTran.postponeAP, Equal <False>, And <LandedCostTran.processed, Equal <False>, And <LandedCostTran.invoiceDate, GreaterEqual <Required <LandedCostTran.invoiceDate> >, And <LandedCostTran.invoiceDate, Less <Required <LandedCostTran.invoiceDate> > > > > > > > > .SelectWindowed(this, 0, 1, financialPeriod.StartDate, financialPeriod.EndDate); if (landedCostTransactions?.LCTranID != null) { throw new PXException(Messages.PeriodHasAPDocsFromPO_LCToBeCreated); } financialPeriod.APClosed = true; Caches[typeof(FinPeriod)].Update(financialPeriod); Actions.PressSave(); }
protected IEnumerable allapprovalsgrid() { return(PXSelectJoin <EPExpenseClaim, LeftJoin <EPView, On <EPView.noteID, Equal <EPExpenseClaim.noteID>, And <EPView.status, Equal <EPViewStatusAttribute.Viewed>, And <EPView.userID, Equal <Current <AccessInfo.userID> > > > > >, Where <EPExpenseClaim.approverID, Equal <Current <AccessInfo.userID> > >, OrderBy <Asc <EPView.userID, Desc <EPExpenseClaim.createdDateTime> > > > .SelectWindowed(this, 0, 5)); }
private static bool CheckForOpenPayments(PXGraph aGraph, string aStatementCycleID) { ARRegister doc = PXSelectJoin <ARPayment, InnerJoin <Customer, On <ARPayment.customerID, Equal <Customer.bAccountID> > >, Where <Customer.statementCycleId, Equal <Required <Customer.statementCycleId> >, And <ARPayment.openDoc, Equal <CS.boolTrue> > > > .SelectWindowed(aGraph, 0, 1, aStatementCycleID); return(doc != null); }
private static bool CheckForOverdueInvoices(PXGraph aGraph, string aStatementCycleID, DateTime aOpDate) { ARBalances doc = PXSelectJoin <ARBalances, InnerJoin <Customer, On <ARBalances.customerID, Equal <Customer.bAccountID> > >, Where <Customer.statementCycleId, Equal <Required <Customer.statementCycleId> >, And <ARBalances.oldInvoiceDate, LessEqual <Required <ARBalances.oldInvoiceDate> > > > > .SelectWindowed(aGraph, 0, 1, aStatementCycleID, aOpDate); return(doc != null); }
private string GenerateBackAddress(EPActivity message, string defaultDisplayName, string defaultAddress, bool suspendCustomAddress) { if (message.Owner == null) { return(string.IsNullOrEmpty(defaultDisplayName) ? defaultAddress : Mailbox.Create(defaultDisplayName, defaultAddress)); } var records = PXSelectJoin <Users, LeftJoin <EPEmployee, On <EPEmployee.userID, Equal <Users.pKID> >, LeftJoin <Contact, On <Contact.contactID, Equal <EPEmployee.defContactID> > > >, Where <Users.pKID, Equal <Required <Users.pKID> > > > . SelectWindowed(_graph, 0, 1, message.Owner); if (records == null || records.Count == 0) { return(defaultAddress); } var row = records[0]; var employee = (Contact)row[typeof(Contact)]; var user = (Users)row[typeof(Users)]; string displayName = null; string address = defaultAddress; if (user != null && user.PKID != null) { var userDisplayName = user.FullName.With(_ => _.Trim()); if (!string.IsNullOrEmpty(userDisplayName)) { displayName = userDisplayName; } var userAddress = user.Email.With(_ => _.Trim()); if (!suspendCustomAddress && !string.IsNullOrEmpty(userAddress)) { address = userAddress; } } if (employee != null && employee.BAccountID != null) { var employeeDisplayName = employee.DisplayName.With(_ => _.Trim()); if (!string.IsNullOrEmpty(employeeDisplayName)) { displayName = employeeDisplayName; } var employeeAddress = employee.EMail.With(_ => _.Trim()); if (!suspendCustomAddress && !string.IsNullOrEmpty(employeeAddress)) { address = employeeAddress; } } return(string.IsNullOrEmpty(displayName) ? address : Mailbox.Create(displayName, address).ToString()); }
protected IEnumerable alleventsgrid() { return(PXSelectJoin <EPActivity, LeftJoin <EPView, On <EPView.noteID, Equal <EPActivity.noteID>, And <EPView.status, Equal <EPViewStatusAttribute.Viewed>, And <EPView.userID, Equal <Current <AccessInfo.userID> > > > > >, Where <EPActivity.classID, Equal <CRActivityClass.events>, And <EPActivity.owner, Equal <Current <AccessInfo.userID> > > >, OrderBy <Asc <EPView.userID, Desc <EPActivity.createdDateTime> > > > .SelectWindowed(this, 0, 5)); }
private static bool CheckForUnreleasedCharges(PXGraph aGraph, string aStatementCycleID) { ARRegister doc = PXSelectJoin <ARRegister, InnerJoin <Customer, On <ARRegister.customerID, Equal <Customer.bAccountID> > >, Where <ARRegister.docType, Equal <ARDocType.finCharge>, And <ARRegister.released, Equal <BQLConstants.BitOff>, And <Customer.statementCycleId, Equal <Customer.statementCycleId> > > > > .SelectWindowed(aGraph, 0, 1, aStatementCycleID); return(doc != null); }
private string ReadTemplateAttachments(SMEmail message) { if (message.Body != null && message.Body.IndexOf("embedded=\"true\"") > -1) { Regex _tempimagesRegex = new Regex("(<(img data-convert=\"view\")[^<>]*(src=\"([^\"]*)\" ([^<>]*)>))"); Regex _tempimagesRegex2 = new Regex("(<img[^<>]*src=(\"[^<>]*GetFile.*;file=([^\"]*)\") ([^<>]*)>)"); List <string> changeimage = new List <string>(); List <int> start = new List <int>(); List <int> length = new List <int>(); foreach (Match match in _tempimagesRegex.Matches(message.Body)) { if (match.Groups[4].Value != null && match.Groups[1].Value.IndexOf("embedded=\"true\"") > -1) { foreach (var result in PXSelectJoin <UploadFile, InnerJoin <UploadFileRevision, On <UploadFile.fileID, Equal <UploadFileRevision.fileID>, And <UploadFile.lastRevisionID, Equal <UploadFileRevision.fileRevisionID> > > >, Where <UploadFile.name, Equal <Required <UploadFile.name> > > > . SelectWindowed(new PXGraph(), 0, 1, HttpUtility.UrlDecode(match.Groups[4].Value))) { UploadFileRevision filedata = result[typeof(UploadFileRevision)] as UploadFileRevision; if (filedata != null) { string tempchangeimage = "<img title=\"\" src=\"data:image/jpeg;base64," + Convert.ToBase64String(filedata.Data) + "\">"; message.Body = message.Body.Replace(match.Groups[1].Value, tempchangeimage); } } } } foreach (Match match in _tempimagesRegex2.Matches(message.Body)) { if (match.Groups[3].Value != null && match.Groups[1].Value.IndexOf("embedded=\"true\"") > -1) { foreach (var result in PXSelectJoin <UploadFile, InnerJoin <UploadFileRevision, On <UploadFile.fileID, Equal <UploadFileRevision.fileID>, And <UploadFile.lastRevisionID, Equal <UploadFileRevision.fileRevisionID> > > >, Where <UploadFile.name, Equal <Required <UploadFile.name> > > > . SelectWindowed(new PXGraph(), 0, 1, HttpUtility.UrlDecode(match.Groups[3].Value))) { UploadFileRevision filedata = result[typeof(UploadFileRevision)] as UploadFileRevision; if (filedata != null) { string tempchangeimage = "<img title=\"\" src=\"data:image/jpeg;base64," + Convert.ToBase64String(filedata.Data) + "\">"; message.Body = message.Body.Replace(match.Groups[1].Value, tempchangeimage); } } } } } return(null); }
public virtual Rate GetEmployeeRate(int?projectId, int?projectTaskId, int?employeeId, DateTime?date) { decimal?hourlyRate = null; decimal?rate = null; PXResult <EPEmployeeRate, EPEmployeeRateByProject> result = ((PXResult <EPEmployeeRate, EPEmployeeRateByProject>) PXSelectJoin < EPEmployeeRate , LeftJoin < EPEmployeeRateByProject , On < EPEmployeeRate.rateID, Equal <EPEmployeeRateByProject.rateID> , And <EPEmployeeRateByProject.projectID, Equal <Required <EPEmployeeRateByProject.projectID> > , And <Where < EPEmployeeRateByProject.taskID, Equal <Required <EPEmployeeRateByProject.taskID> > , Or <EPEmployeeRateByProject.taskID, IsNull> > > > > > , Where < EPEmployeeRate.employeeID, Equal <Required <EPEmployeeRate.employeeID> > , And <EPEmployeeRate.effectiveDate, LessEqual <Required <EPEmployeeRate.effectiveDate> > > > , OrderBy <Desc <EPEmployeeRate.effectiveDate, Desc <EPEmployeeRateByProject.taskID> > > > .SelectWindowed(graph, 0, 1, projectId, projectTaskId, employeeId, date)). With(_ => (_)); EPEmployeeRateByProject employeeRateByProject = (EPEmployeeRateByProject)result; EPEmployeeRate employeeRate = (EPEmployeeRate)result; if (employeeRateByProject != null && employeeRateByProject.HourlyRate != null) { hourlyRate = employeeRateByProject.HourlyRate; } else if (employeeRate != null) { hourlyRate = employeeRate.HourlyRate; } else { CR.BAccountR baccount = PXSelect <CR.BAccountR, Where <CR.BAccountR.bAccountID, Equal <Required <CR.BAccountR.bAccountID> > > > .Select(graph, employeeId); throw new PXException(string.Format(Messages.HourlyRateIsNotSet, date, baccount.AcctCD)); } if (employeeRate.RateType == RateTypesAttribute.Hourly) { rate = hourlyRate; } else { rate = hourlyRate * employeeRate.RegularHours; } return(new Rate(employeeId, employeeRate.RateType, hourlyRate, defaultUOM, employeeRate.RegularHours, rate)); }
protected virtual void AP1099YearMaster_MasterBranchID_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e) { PXResultset <Ledger> results = PXSelectJoin <Ledger, LeftJoin <Branch, On <Branch.ledgerID, Equal <Ledger.ledgerID> > >, Where <Branch.branchID, Equal <Required <AccessInfo.branchID> > > > .SelectWindowed(this, 0, 1, this.Accessinfo.BranchID); if (results.Count > 0) { e.NewValue = ((Ledger)results[0]).DefBranchID ?? this.Accessinfo.BranchID; } }
public static int?FetchLocation(PXGraph graph, int?vendorID, int?itemID, int?subItemID, int?siteID) { BAccountR company = PXSelectJoin <BAccountR, InnerJoin <Branch, On <Branch.bAccountID, Equal <BAccountR.bAccountID> > >, Where <BAccountR.bAccountID, Equal <Required <BAccountR.bAccountID> > > > .Select(graph, vendorID); if (company != null) { return(company.DefLocationID); } var rec = (PXResult <INItemSiteSettings, POVendorInventory>) PXSelectJoin <INItemSiteSettings, LeftJoin <POVendorInventory, On <POVendorInventory.inventoryID, Equal <INItemSiteSettings.inventoryID>, And <POVendorInventory.active, Equal <boolTrue>, And <POVendorInventory.vendorID, Equal <Required <Vendor.bAccountID> >, And <Where <POVendorInventory.subItemID, Equal <Required <POVendorInventory.subItemID> >, Or <POVendorInventory.subItemID, Equal <INItemSiteSettings.defaultSubItemID>, Or <POVendorInventory.subItemID, IsNull, Or <Where <Required <POVendorInventory.subItemID>, IsNull, And <POVendorInventory.subItemID, Equal <True> > > > > > > > > > > >, Where <INItemSiteSettings.inventoryID, Equal <Required <INItemSiteSettings.inventoryID> >, And <INItemSiteSettings.siteID, Equal <Required <INItemSiteSettings.siteID> > > >, OrderBy <Asc <POVendorInventory.lastPrice, Asc <Switch <Case <Where <POVendorInventory.subItemID, Equal <INItemSiteSettings.defaultSubItemID> >, boolTrue>, boolFalse>, Asc <Switch <Case <Where <POVendorInventory.vendorLocationID, IsNull>, boolTrue>, boolFalse> > > > > > .SelectWindowed(graph, 0, 1, vendorID, subItemID, subItemID, itemID, siteID); if (rec == null) { return(null); } POVendorInventory i = rec; INItemSiteSettings site = rec; if (i.VendorLocationID != null) { return(i.VendorLocationID); } Vendor vendor = PXSelectReadonly <Vendor, Where <Vendor.bAccountID, Equal <Required <Vendor.bAccountID> > > > .Select(graph, vendorID); if (site.PreferredVendorID == vendorID) { return(site.PreferredVendorLocationID ?? (vendor != null ? vendor.DefLocationID : null)); } if (vendor != null && vendor.BAccountID == vendorID) { return(vendor.DefLocationID); } return(null); }
public virtual void CheckPartiallyReceiptedPOServices(PXCache sender, PXFieldUpdatedEventArgs e, string poOrderType) { POSetup row = (POSetup)e.Row; if (row != null) { PXResultset <POLine> partiallyReceiptedPOServices = PXSelectJoin <POLine, InnerJoin <IN.InventoryItem, On <IN.InventoryItem.inventoryID, Equal <POLine.inventoryID> > >, Where <POLine.orderType, Equal <Required <POLine.orderType> >, And <POLine.lineType, Equal <POLineType.service>, And <POLine.completed, NotEqual <True>, And <POLine.receivedQty, NotEqual <decimal0> > > > > > .SelectWindowed(this, 0, 1000, poOrderType); if (partiallyReceiptedPOServices.Count > 0) { if (poOrderType == POOrderType.RegularOrder) { if (row.AddServicesFromNormalPOtoPR == true) { PXUIFieldAttribute.SetWarning <POSetup.addServicesFromNormalPOtoPR>(sender, row, Messages.PossibleOverbillingAPNormalPO); } else { PXUIFieldAttribute.SetWarning <POSetup.addServicesFromNormalPOtoPR>(sender, row, Messages.PossibleOverbillingPRNormalPO); } } else { if (row.AddServicesFromDSPOtoPR == true) { PXUIFieldAttribute.SetWarning <POSetup.addServicesFromDSPOtoPR>(sender, row, Messages.PossibleOverbillingAPDSPO); } else { PXUIFieldAttribute.SetWarning <POSetup.addServicesFromDSPOtoPR>(sender, row, Messages.PossibleOverbillingPRDSPO); } } string overbillingMessage = Messages.PossibleOverbillingTraceList + " \n"; int i = 0; foreach (PXResult <POLine, IN.InventoryItem> line in partiallyReceiptedPOServices) { POLine poline = (POLine)line; IN.InventoryItem item = (IN.InventoryItem)line; overbillingMessage += string.Format(Messages.PossibleOverbillingTraceMessage, (poOrderType == POOrderType.RegularOrder ? Messages.RegularOrder : Messages.DropShip), poline.OrderNbr, poline.LineNbr, item.InventoryCD) + "\n"; i++; if (i >= 1000) { break; } } PXTrace.WriteWarning(overbillingMessage); } } }
private static PXResult <CSCalendar, CSCalendarExceptions> SelectCalendar(PXGraph graph, string calendarID, DateTime date) { var result = (PXResult <CSCalendar, CSCalendarExceptions>) PXSelectJoin < CSCalendar , LeftJoin <CSCalendarExceptions , On <CSCalendarExceptions.calendarID, Equal <CSCalendar.calendarID>, And <CSCalendarExceptions.date, Equal <Required <CSCalendarExceptions.date> > > > > , Where <CSCalendar.calendarID, Equal <Required <CSCalendar.calendarID> > > > .SelectWindowed(graph, 0, 1, date, calendarID); return(result); }
protected virtual void _(Events.FieldVerifying <PMChangeOrderClass, PMChangeOrderClass.isPurchaseOrderEnabled> e) { var select = new PXSelectJoin <PMChangeOrderLine, InnerJoin <PMChangeOrder, On <PMChangeOrderLine.refNbr, Equal <PMChangeOrder.refNbr> > >, Where <PMChangeOrder.classID, Equal <Current <PMChangeOrderClass.classID> > > >(this); PMChangeOrderLine res = select.SelectWindowed(0, 1); if (res != null) { throw new PXSetPropertyException <PMChangeOrderClass.isPurchaseOrderEnabled>(Messages.ClassContainsDetails); } }
private void GenerateOwnerAddress(PXGraph graph, Guid?owner, out string displayName, out string address) { displayName = null; address = null; if (owner == null) { return; } var records = PXSelectJoin <Users, LeftJoin <EPEmployee, On <EPEmployee.userID, Equal <Users.pKID> >, LeftJoin <Contact, On <Contact.contactID, Equal <EPEmployee.defContactID> > > >, Where <Users.pKID, Equal <Required <Users.pKID> > > > . SelectWindowed(graph, 0, 1, owner); if (records == null || records.Count == 0) { return; } var row = records[0]; var employee = (Contact)row[typeof(Contact)]; var user = (Users)row[typeof(Users)]; if (user != null && user.PKID != null) { var userDisplayName = user.FullName.With(_ => _.Trim()); if (!string.IsNullOrEmpty(userDisplayName)) { displayName = userDisplayName; } var userAddress = user.Email.With(_ => _.Trim()); if (!string.IsNullOrEmpty(userAddress)) { address = userAddress; } } if (employee != null && employee.BAccountID != null) { var employeeDisplayName = employee.DisplayName.With(_ => _.Trim()); if (!string.IsNullOrEmpty(employeeDisplayName)) { displayName = employeeDisplayName; } var employeeAddress = employee.EMail.With(_ => _.Trim()); if (!string.IsNullOrEmpty(employeeAddress)) { address = employeeAddress; } } }
protected virtual void _(Events.FieldVerifying <PMChangeOrderClass, PMChangeOrderClass.isRevenueBudgetEnabled> e) { var select = new PXSelectJoin <PMChangeOrderBudget, InnerJoin <PMChangeOrder, On <PMChangeOrderBudget.refNbr, Equal <PMChangeOrder.refNbr> > >, Where <PMChangeOrderBudget.type, Equal <GL.AccountType.income>, And <PMChangeOrder.classID, Equal <Current <PMChangeOrderClass.classID> > > > >(this); PMChangeOrderBudget res = select.SelectWindowed(0, 1); if (res != null) { throw new PXSetPropertyException <PMChangeOrderClass.isRevenueBudgetEnabled>(Messages.ClassContainsRevenueBudget); } }
protected virtual void _(Events.FieldVerifying <PMChangeOrderClass, PMChangeOrderClass.isAdvance> e) { if ((bool?)e.NewValue != true) { var select = new PXSelectJoin <PMChangeRequest, InnerJoin <PMChangeOrder, On <PMChangeRequest.changeOrderNbr, Equal <PMChangeOrder.refNbr> > >, Where <PMChangeOrder.classID, Equal <Current <PMChangeOrderClass.classID> > > >(this); PMChangeRequest res = select.SelectWindowed(0, 1); if (res != null) { throw new PXSetPropertyException <PMChangeOrderClass.isAdvance>(Messages.ClassContainsCRs); } } }
protected virtual IAddressBase GetFromAddress(APInvoice invoice) { return (PXSelectJoin <Address, InnerJoin <Location, On <Location.defAddressID, Equal <Address.addressID> > >, Where <Location.locationID, Equal <Required <Location.locationID> > > > .SelectWindowed(Base, 0, 1, new object[] { PXAccess.FeatureInstalled <FeaturesSet.vendorRelations>() ? invoice.SuppliedByVendorLocationID : invoice.VendorLocationID }) .RowCast <Address>() .FirstOrDefault()); }
protected virtual void _(Events.RowSelected <ARPayment> e) { if (e.Row == null) { return; } ARPayment arPaymentRow = (ARPayment)e.Row; bool atleastoneFSAdjust = FSAdjustments.SelectWindowed(0, 1).Count > 0; FSAdjustments.Cache.AllowInsert = !(atleastoneFSAdjust); FSAdjustments.Cache.AllowDelete = false; FSAdjustments.AllowSelect = arPaymentRow.CreatedByScreenID == ID.ScreenID.APPOINTMENT || arPaymentRow.CreatedByScreenID == ID.ScreenID.SERVICE_ORDER || atleastoneFSAdjust; }
/// <summary><see cref="InventoryByClassFilter.InventoryID"/> Updated</summary> protected virtual void InventoryByClassFilter_InventoryID_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e) { var row = (InventoryByClassFilter)e.Row; if (row?.InventoryID != null) { INItemClass current = PXSelectJoin <INItemClass, InnerJoin <InventoryItem, On <INItemClass.itemClassID, Equal <InventoryItem.itemClassID> > >, Where <InventoryItem.inventoryID, Equal <Required <InventoryItem.inventoryID> > > > .SelectWindowed(this, 0, 1, row.InventoryID); _allowToSyncTreeCurrentWithPrimaryViewCurrent = true; _forbidToSyncTreeCurrentWithPrimaryViewCurrent = false; _keepInventoryFilter = true; ItemClassFilter.Current = current; } }
protected virtual void AP1099Year_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { AP1099Year year1099 = (AP1099Year)e.Row; if (year1099 == null) { return; } close1099Year.SetEnabled(!string.IsNullOrEmpty(year1099.FinYear) && year1099.Status == AP1099Year.status.Open); int?[] childBranches = BranchMaint.GetChildBranches(this, Year_Header.Current.BranchID) .Select(branch => branch.BranchID) .ToArray(); if (childBranches.Length == 0) { return; } bool hasUnappliedPrepayments = PXSelectJoin <APRegister, InnerJoin <Vendor, On <APRegister.vendorID, Equal <Vendor.bAccountID> >, InnerJoin <FinPeriod, On <APRegister.finPeriodID, Equal <FinPeriod.finPeriodID> > > >, Where <Vendor.vendor1099, Equal <True>, And <APRegister.docType, Equal <APDocType.prepayment>, And <APRegister.status, NotEqual <APDocStatus.closed>, And <FinPeriod.finYear, Equal <Current <AP1099Year.finYear> >, And <APRegister.branchID, In <Required <APRegister.branchID> > > > > > > > .SelectWindowed(this, 0, 1, childBranches) .Any(); PXSetPropertyException finYearExeption = hasUnappliedPrepayments ? new PXSetPropertyException(Messages.ExistsUnappliedPayments, PXErrorLevel.Warning, year1099.FinYear) : null; sender.RaiseExceptionHandling <AP1099Year.finYear>( year1099, year1099.FinYear, finYearExeption); }
/// <summary> /// Validates that there are no Quantities on hand on any Project Locations for the given Warehouse. /// </summary> /// <param name="site">Warehouse</param> public virtual void ValidateProjectLocation(INSite site, InventoryItem item) { var select = new PXSelectJoin <INLocationStatus, InnerJoin <INLocation, On <INLocation.locationID, Equal <INLocationStatus.locationID> > >, Where <INLocation.siteID, Equal <Required <INLocation.siteID> >, And <INLocation.isCosted, Equal <True>, And <INLocation.taskID, IsNotNull, And <INLocationStatus.inventoryID, Equal <Required <INLocationStatus.inventoryID> >, And <INLocationStatus.qtyOnHand, NotEqual <decimal0> > > > > > >(this); var res = select.SelectWindowed(0, 1, site.SiteID, item.InventoryID); if (res.Count == 1) { INLocation loc = (PXResult <INLocationStatus, INLocation>)res.First(); throw new PXException(Messages.StandardCostItemOnProjectLocation, loc.LocationCD); } }
protected void ARPayment_RowSelected(PXCache cache, PXRowSelectedEventArgs e) { if (e.Row == null) { return; } ARPayment arPaymentRow = (ARPayment)e.Row; PXUIFieldAttribute.SetVisible <FSxARPayment.serviceContractID>(cache, arPaymentRow, PXAccess.FeatureInstalled <FeaturesSet.equipmentManagementModule>() == true && arPaymentRow.DocType == ARPaymentType.Prepayment); bool atleastoneFSAdjust = FSAdjustments.SelectWindowed(0, 1).Count > 0; FSAdjustments.Cache.AllowInsert = !(atleastoneFSAdjust); FSAdjustments.Cache.AllowDelete = false; FSAdjustments.AllowSelect = arPaymentRow.CreatedByScreenID == ID.ScreenID.APPOINTMENT || arPaymentRow.CreatedByScreenID == ID.ScreenID.SERVICE_ORDER || atleastoneFSAdjust; }
private void FillOwnerWorkgroup(ref Guid?OwnerID, ref int?WorkgroupID) { if (WorkgroupID != null && OwnerID != null) { EPCompanyTreeMember member = PXSelectJoin < EPCompanyTreeMember, InnerJoin <EPCompanyTreeH, On <EPCompanyTreeH.workGroupID, Equal <EPCompanyTreeMember.workGroupID> >, InnerJoin <EPEmployee, On <EPEmployee.userID, Equal <EPCompanyTreeMember.userID> > > >, Where <EPCompanyTreeH.parentWGID, Equal <Required <EPCompanyTreeH.parentWGID> >, And <EPCompanyTreeMember.userID, Equal <Required <EPCompanyTreeMember.userID> > > > > .SelectWindowed(this, 0, 1, WorkgroupID, OwnerID); if (member != null) { WorkgroupID = member.WorkGroupID; } else { OwnerID = null; } } if (WorkgroupID != null && OwnerID == null) { EPCompanyTreeMember owner = PXSelectJoin < EPCompanyTreeMember, InnerJoin <EPEmployee, On <EPEmployee.userID, Equal <EPCompanyTreeMember.userID> > >, Where <EPCompanyTreeMember.workGroupID, Equal <Required <EPCompanyTreeMember.workGroupID> >, And <EPCompanyTreeMember.isOwner, Equal <boolTrue> > > > .Select(this, WorkgroupID); if (owner != null) { OwnerID = owner.UserID; } } }
private void SetControlsState(PXCache cache, ContractItem row) { ContractDetail activeDetail = PXSelectJoin <ContractDetail, InnerJoin <Contract, On <ContractDetail.contractID, Equal <Contract.contractID> > >, Where <ContractDetail.contractItemID, Equal <Required <ContractItem.contractItemID> >, And2 <Where <Contract.status, Equal <Contract.status.active>, Or <Contract.status, Equal <Contract.status.inUpgrade> > >, And <Contract.baseType, Equal <CTPRType.contract> > > > > .SelectWindowed(this, 0, 1, row.ContractItemID); bool used = activeDetail != null; PXUIFieldAttribute.SetEnabled <ContractItem.recurringType>(cache, row, !used); PXUIFieldAttribute.SetEnabled <ContractItem.recurringItemID>(cache, row, row.RecurringType != RecurringOption.None && !used && row.Deposit != true); PXUIFieldAttribute.SetEnabled <ContractItem.basePriceOption>(cache, row, row.BaseItemID != null); PXUIFieldAttribute.SetEnabled <ContractItem.basePrice>(cache, row, row.BaseItemID != null && row.BasePriceOption != "I"); PXUIFieldAttribute.SetEnabled <ContractItem.renewalPriceOption>(cache, row, row.RenewalItemID != null); PXUIFieldAttribute.SetEnabled <ContractItem.renewalPrice>(cache, row, row.RenewalItemID != null && row.RenewalPriceOption != "I"); PXUIFieldAttribute.SetEnabled <ContractItem.fixedRecurringPriceOption>(cache, row, row.RecurringType != RecurringOption.None && row.RecurringItemID != null && !used); PXUIFieldAttribute.SetEnabled <ContractItem.fixedRecurringPrice>(cache, row, row.RecurringType != RecurringOption.None && row.RecurringItemID != null && row.FixedRecurringPriceOption != "I" && !used); PXUIFieldAttribute.SetEnabled <ContractItem.usagePriceOption>(cache, row, row.RecurringType != RecurringOption.None && row.RecurringItemID != null); PXUIFieldAttribute.SetEnabled <ContractItem.usagePrice>(cache, row, row.RecurringType != RecurringOption.None && row.RecurringItemID != null && row.UsagePriceOption != "I"); PXUIFieldAttribute.SetEnabled <ContractItem.depositItemID>(cache, row, row.RecurringType != RecurringOption.None); PXUIFieldAttribute.SetVisible <ContractItem.collectRenewFeeOnActivation>(cache, row, row.Deposit != true); PXUIFieldAttribute.SetVisible <ContractItem.renewalPriceOption>(cache, row, row.Deposit != true); PXUIFieldAttribute.SetVisible <ContractItem.renewalPrice>(cache, row, row.Deposit != true); PXUIFieldAttribute.SetVisible <ContractItem.renewalItemID>(cache, row, row.Deposit != true); PXUIFieldAttribute.SetVisible <ContractItem.recurringItemID>(cache, row, row.Deposit != true); PXUIFieldAttribute.SetVisible <ContractItem.recurringType>(cache, row, row.Deposit != true); PXUIFieldAttribute.SetVisible <ContractItem.resetUsageOnBilling>(cache, row, row.Deposit != true); PXUIFieldAttribute.SetVisible <ContractItem.fixedRecurringPriceOption>(cache, row, row.Deposit != true); PXUIFieldAttribute.SetVisible <ContractItem.fixedRecurringPrice>(cache, row, row.Deposit != true); PXUIFieldAttribute.SetVisible <ContractItem.usagePriceOption>(cache, row, row.Deposit != true); PXUIFieldAttribute.SetVisible <ContractItem.usagePrice>(cache, row, row.Deposit != true); PXUIFieldAttribute.SetVisible <ContractItem.depositItemID>(cache, row, row.Deposit != true); PXUIFieldAttribute.SetEnabled <ContractItem.deposit>(cache, row, row.BaseItemID != null && !(used && row.RecurringItemID != null)); PXUIFieldAttribute.SetEnabled <ContractItem.prorateSetup>(cache, row, row.BaseItemID != null); PXUIFieldAttribute.SetEnabled <ContractItem.collectRenewFeeOnActivation>(cache, row, row.RenewalItemID != null); PXUIFieldAttribute.SetEnabled <ContractItem.resetUsageOnBilling>(cache, row, row.RecurringType != RecurringOption.None && row.DepositItemID == null); }
private void SetControlsState(PXCache cache, ContractItem row) { ContractDetail activeDetail = PXSelectJoin <ContractDetail, InnerJoin <Contract, On <ContractDetail.contractID, Equal <Contract.contractID> > >, Where <ContractDetail.contractItemID, Equal <Required <ContractItem.contractItemID> >, And <Contract.status, Equal <ContractStatus.ContractStatusActivated>, And <Contract.isTemplate, Equal <False> > > > > .SelectWindowed(this, 0, 1, row.ContractItemID); bool used = activeDetail != null; PXUIFieldAttribute.SetEnabled <ContractItem.recurringItemID>(cache, row, row.RecurringType != "N" && !used && row.Deposit != true); PXUIFieldAttribute.SetEnabled <ContractItem.basePriceOption>(cache, row, row.BaseItemID != null); PXUIFieldAttribute.SetEnabled <ContractItem.basePrice>(cache, row, row.BaseItemID != null && row.BasePriceOption != "I"); PXUIFieldAttribute.SetEnabled <ContractItem.renewalPriceOption>(cache, row, row.RenewalItemID != null); PXUIFieldAttribute.SetEnabled <ContractItem.renewalPrice>(cache, row, row.RenewalItemID != null && row.RenewalPriceOption != "I"); PXUIFieldAttribute.SetEnabled <ContractItem.fixedRecurringPriceOption>(cache, row, row.RecurringType != "N" && row.RecurringItemID != null); PXUIFieldAttribute.SetEnabled <ContractItem.fixedRecurringPrice>(cache, row, row.RecurringType != "N" && row.RecurringItemID != null && row.FixedRecurringPriceOption != "I"); PXUIFieldAttribute.SetEnabled <ContractItem.usagePriceOption>(cache, row, row.RecurringType != "N" && row.RecurringItemID != null); PXUIFieldAttribute.SetEnabled <ContractItem.usagePrice>(cache, row, row.RecurringType != "N" && row.RecurringItemID != null && row.UsagePriceOption != "I"); PXUIFieldAttribute.SetEnabled <ContractItem.depositItemID>(cache, row, row.RecurringType != "N"); PXUIFieldAttribute.SetEnabled <ContractItem.retainRate>(cache, row, row.Deposit == true); PXUIFieldAttribute.SetVisible <ContractItem.collectRenewFeeOnActivation>(cache, row, row.Deposit != true); PXUIFieldAttribute.SetVisible <ContractItem.renewalPriceOption>(cache, row, row.Deposit != true); PXUIFieldAttribute.SetVisible <ContractItem.renewalPrice>(cache, row, row.Deposit != true); PXUIFieldAttribute.SetVisible <ContractItem.renewalItemID>(cache, row, row.Deposit != true); PXUIFieldAttribute.SetVisible <ContractItem.recurringItemID>(cache, row, row.Deposit != true); PXUIFieldAttribute.SetVisible <ContractItem.recurringType>(cache, row, row.Deposit != true); PXUIFieldAttribute.SetVisible <ContractItem.resetUsageOnBilling>(cache, row, row.Deposit != true); PXUIFieldAttribute.SetVisible <ContractItem.fixedRecurringPriceOption>(cache, row, row.Deposit != true); PXUIFieldAttribute.SetVisible <ContractItem.fixedRecurringPrice>(cache, row, row.Deposit != true); PXUIFieldAttribute.SetVisible <ContractItem.usagePriceOption>(cache, row, row.Deposit != true); PXUIFieldAttribute.SetVisible <ContractItem.usagePrice>(cache, row, row.Deposit != true); PXUIFieldAttribute.SetVisible <ContractItem.depositItemID>(cache, row, row.Deposit != true); PXUIFieldAttribute.SetEnabled <ContractItem.deposit>(cache, row, row.BaseItemID != null); PXUIFieldAttribute.SetEnabled <ContractItem.prorateSetup>(cache, row, row.BaseItemID != null); PXUIFieldAttribute.SetEnabled <ContractItem.collectRenewFeeOnActivation>(cache, row, row.RenewalItemID != null); PXUIFieldAttribute.SetEnabled <ContractItem.refundable>(cache, row, row.BaseItemID != null || row.RenewalItemID != null || row.RecurringItemID != null); PXUIFieldAttribute.SetEnabled <ContractItem.resetUsageOnBilling>(cache, row, row.DepositItemID == null); }
private static PXResult <Currency, CurrencyRateByDate> GetCurrencyAndRateByDate(PXGraph graph, Vendor curVendor, Company company, TaxPeriod period) { var curyWithRateSet = (PXResult <Currency, CurrencyRateByDate>) PXSelectJoin <Currency, LeftJoin < CurrencyRateByDate, On <CurrencyRateByDate.fromCuryID, Equal <Currency.curyID>, And <CurrencyRateByDate.toCuryID, Equal <Required <Company.baseCuryID> >, And <CurrencyRateByDate.curyRateType, Equal <Required <CurrencyRateByDate.curyRateType> >, And <CurrencyRateByDate.curyEffDate, LessEqual <Required <CurrencyRateByDate.curyEffDate> >, And < Where < CurrencyRateByDate.nextEffDate, Greater <Required <CurrencyRateByDate.curyEffDate> >, Or <CurrencyRateByDate.nextEffDate, IsNull> > > > > > > >, Where <Currency.curyID, Equal <Required <Currency.curyID> > > > .SelectWindowed(graph, StartRow, TotalRows, company.BaseCuryID, curVendor.CuryRateTypeID, period.EndDate, period.EndDate, curVendor.CuryID ?? company.BaseCuryID); return(curyWithRateSet); }