protected virtual void InventoryItem_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { InventoryItem item = e.Row as InventoryItem; if (item == null) { return; } InventoryItemRUTROT itemRR = PXCache <InventoryItem> .GetExtension <InventoryItemRUTROT>(item); Branch branch = Base.CurrentBranch.SelectSingle(PXAccess.GetBranchID()); BranchRUTROT branchRR = RUTROTHelper.GetExtensionNullable <Branch, BranchRUTROT>(branch); bool allowRUTROT = branchRR?.AllowsRUTROT == true; bool isOtherCostOrNull = itemRR.RUTROTItemType == null || itemRR.RUTROTItemType == RUTROTItemTypes.OtherCost; PXUIFieldAttribute.SetVisible <InventoryItemRUTROT.isRUTROTDeductible>(sender, item, allowRUTROT); PXUIFieldAttribute.SetVisible <InventoryItemRUTROT.isRUTROTDeductible>(Base.Item.Cache, item, allowRUTROT); PXUIFieldAttribute.SetVisible <InventoryItemRUTROT.rUTROTItemType>(Base.Item.Cache, item, allowRUTROT); PXUIFieldAttribute.SetVisible <InventoryItemRUTROT.rUTROTType>(Base.Item.Cache, item, allowRUTROT); PXUIFieldAttribute.SetVisible <InventoryItemRUTROT.rUTROTWorkTypeID>(Base.Item.Cache, item, allowRUTROT); PXUIFieldAttribute.SetEnabled <InventoryItemRUTROT.rUTROTWorkTypeID>(sender, item, !isOtherCostOrNull && itemRR.IsRUTROTDeductible == true); PXUIFieldAttribute.SetEnabled <InventoryItemRUTROT.rUTROTItemType>(sender, item, itemRR.IsRUTROTDeductible == true); PXUIFieldAttribute.SetEnabled <InventoryItemRUTROT.rUTROTType>(sender, item, itemRR.IsRUTROTDeductible == true); if (!isOtherCostOrNull && !RUTROTHelper.IsUpToDateWorkType(itemRR.RUTROTWorkTypeID, this.Base.Accessinfo.BusinessDate ?? DateTime.Now, this.Base)) { sender.RaiseExceptionHandling <InventoryItemRUTROT.rUTROTWorkTypeID>(item, itemRR.RUTROTWorkTypeID, new PXSetPropertyException(RUTROTMessages.ObsoleteWorkTypeWarning, PXErrorLevel.Warning)); } else { sender.RaiseExceptionHandling <InventoryItemRUTROT.rUTROTWorkTypeID>(item, itemRR.RUTROTWorkTypeID, null); } }
/// <summary> /// Fill the branches drop-down list. /// </summary> private void FillBrachesList() { PXToolBarContainer cont = (PXToolBarContainer)tlbPath.Items["branch"]; PXDropDown dropDown = this.GetBranchCombo(); if (ControlHelper.IsReloadPage(dropDown)) { dropDown.CallbackUpdatable = true; } string currBranchId = null; int? currentBranch = PXAccess.GetBranchID(); List <PXAccess.BranchCollection.Info> items = GetBranches().ToList(); items.Sort((a, b) => string.Compare(a.Cd, b.Cd)); dropDown.Items.Clear(); foreach (PXAccess.BranchCollection.Info item in items) { var current = (currentBranch != null && currentBranch.Equals(item.Id)); dropDown.Items.Add(new PXListItem(item.Name, item.Id.ToString())); if (current) { currBranchId = item.Id.ToString(); } } if (PXAccess.FeatureInstalled("PX.Objects.CS.FeaturesSet+Branch") && dropDown.Items.Count > 0) { if (ControlHelper.IsReloadPage(tlbPath)) { tlbPath.CallbackUpdatable = true; } if (currentBranch != null) { dropDown.Value = currBranchId; } else { dropDown.Items.Insert(0, new PXListItem("Select Branch", null)); } dropDown.ItemChanged += Branch_ItemClick; } else { cont.Visible = false; PXToolBarLabel lbl = tlbPath.Items["branchLabel"] as PXToolBarLabel; if (lbl != null) { lbl.Visible = false; } lbl = tlbPath.Items["branchSep"] as PXToolBarLabel; if (lbl != null) { lbl.Visible = false; } } }
private int GetClaimNumber() { var branch = CurrentBranch.SelectSingle(PXAccess.GetBranchID()); if (branch == null) { return(0); } return(branch.RUTROTClaimNextRefNbr ?? 0); }
private int GetClaimNumber() { var branch = CurrentBranch.SelectSingle(PXAccess.GetBranchID()); if (branch == null) { return(0); } return(PXCache <GL.Branch> .GetExtension <BranchRUTROT>(branch).RUTROTClaimNextRefNbr ?? 0); }
private void UpdateClaimNumber() { var branch = CurrentBranch.SelectSingle(PXAccess.GetBranchID()); if (branch == null) { return; } branch.RUTROTClaimNextRefNbr += 1; CurrentBranch.Cache.Update(branch); }
private void UpdateClaimNumber() { var branch = CurrentBranch.SelectSingle(PXAccess.GetBranchID()); if (branch == null) { return; } PXCache <GL.Branch> .GetExtension <BranchRUTROT>(branch).RUTROTClaimNextRefNbr += 1; CurrentBranch.Cache.Update(branch); }
protected virtual IEnumerable cOCReport(PXAdapter adapter) { var _reportID = "lm601000"; if (Base.Document.Current != null) { Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters["ShipmentNbr"] = Base.Document.Current.ShipmentNbr; parameters["ShipmentType"] = Base.Document.Current.ShipmentType; parameters["_CompanyID"] = PXAccess.GetBranchID().ToString(); throw new PXReportRequiredException(parameters, _reportID, string.Format("Report {0}", _reportID)); } return(adapter.Get()); }
public object GetBranchIDByCD(object branchCD) { return(PXAccess.GetBranchID((string)branchCD)); }
protected virtual void PrintChecksFilter_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { bool SuggestNextNumber = false; PrintChecksFilter filter = (PrintChecksFilter)e.Row; PXUIFieldAttribute.SetVisible <PrintChecksFilter.curyID>(sender, null, PXAccess.FeatureInstalled <FeaturesSet.multicurrency>()); if (e.Row != null && cashaccountdetail.Current != null && (!Equals(cashaccountdetail.Current.CashAccountID, filter.PayAccountID) || !Equals(cashaccountdetail.Current.PaymentMethodID, filter.PayTypeID))) { cashaccountdetail.Current = null; SuggestNextNumber = true; } if (e.Row != null && paymenttype.Current != null && (!Equals(paymenttype.Current.PaymentMethodID, filter.PayTypeID))) { paymenttype.Current = null; } if (e.Row != null && string.IsNullOrEmpty(filter.NextCheckNbr)) { SuggestNextNumber = true; } PXUIFieldAttribute.SetVisible <PrintChecksFilter.nextCheckNbr>(sender, null, true); if (e.Row == null) { return; } if (cashaccountdetail.Current != null && true == cashaccountdetail.Current.APAutoNextNbr && SuggestNextNumber) { filter.NextCheckNbr = PaymentRefAttribute.GetNextPaymentRef( sender.Graph, cashaccountdetail.Current.CashAccountID, cashaccountdetail.Current.PaymentMethodID); } bool printOrExport = paymenttype.Current == null || paymenttype.Current.PrintOrExport == true; bool isNextNumberDuplicated = false; if (paymenttype.Current != null && paymenttype.Current.PrintOrExport == true && string.IsNullOrEmpty(filter.NextCheckNbr)) { sender.RaiseExceptionHandling <PrintChecksFilter.nextCheckNbr>(e.Row, filter.NextCheckNbr, new PXSetPropertyException(Messages.NextCheckNumberIsRequiredForProcessing, PXErrorLevel.Warning)); } else if (!string.IsNullOrEmpty(filter.NextCheckNbr) && !AutoNumberAttribute.CanNextNumber(filter.NextCheckNbr)) { sender.RaiseExceptionHandling <PrintChecksFilter.nextCheckNbr>(e.Row, filter.NextCheckNbr, new PXSetPropertyException(Messages.NextCheckNumberCanNotBeInc, PXErrorLevel.Warning)); } else if (paymenttype.Current != null && paymenttype.Current.APPrintChecks == true && (isNextNumberDuplicated = filter.IsNextNumberDuplicated(sender.Graph, filter.NextCheckNbr))) { sender.RaiseExceptionHandling <PrintChecksFilter.nextCheckNbr>(e.Row, filter.NextCheckNbr, new PXSetPropertyException(Messages.ConflictWithExistingCheckNumber, filter.NextCheckNbr)); } else { sender.RaiseExceptionHandling <PrintChecksFilter.nextCheckNbr>(e.Row, filter.NextCheckNbr, null); } APPaymentList.SetProcessEnabled(!isNextNumberDuplicated && printOrExport && filter.PayTypeID != null); APPaymentList.SetProcessAllEnabled(!isNextNumberDuplicated && printOrExport && filter.PayTypeID != null); if (HttpContext.Current != null && Filter.Current.BranchID != PXAccess.GetBranchID()) { Filter.Current.BranchID = PXAccess.GetBranchID(); } PaymentMethod pt = paymenttype.Current; APPaymentList.SetProcessDelegate( delegate(List <APPayment> list) { APPrintChecks graph = CreateInstance <APPrintChecks>(); graph.PrintPayments(list, filter, pt); } ); }
protected virtual void ProcessPaymentFilter_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { bool SuggestNextNumber = false; ProcessPaymentFilter row = (ProcessPaymentFilter)e.Row; PXUIFieldAttribute.SetVisible <ProcessPaymentFilter.curyID>(sender, null, PXAccess.FeatureInstalled <FeaturesSet.multicurrency>()); if (e.Row != null && cashaccountdetail.Current != null && (!Equals(cashaccountdetail.Current.CashAccountID, row.PayAccountID) || !Equals(cashaccountdetail.Current.PaymentMethodID, row.PayTypeID))) { cashaccountdetail.Current = null; SuggestNextNumber = true; } if (e.Row != null && paymenttype.Current != null && (!Equals(paymenttype.Current.PaymentMethodID, row.PayTypeID))) { paymenttype.Current = null; } if (e.Row != null && string.IsNullOrEmpty(row.NextCheckNbr)) { SuggestNextNumber = true; } PXUIFieldAttribute.SetVisible <ProcessPaymentFilter.nextCheckNbr>(sender, null, true); if (e.Row == null) { return; } if (cashaccountdetail.Current != null && true == cashaccountdetail.Current.ARAutoNextNbr && SuggestNextNumber) { row.NextCheckNbr = string.IsNullOrEmpty(cashaccountdetail.Current.ARLastRefNbr) == false?AutoNumberAttribute.NextNumber(cashaccountdetail.Current.ARLastRefNbr) : string.Empty; } sender.RaiseExceptionHandling <ProcessPaymentFilter.payTypeID>(e.Row, row.PayTypeID, paymenttype.Current != null && true != PXCache <PaymentMethod> .GetExtension <PaymentMethodExt>(paymenttype.Current).ARCreateBatchPayment ? new PXSetPropertyException(AP.Messages.PaymentTypeNoPrintCheck, PXErrorLevel.Warning) : null); sender.RaiseExceptionHandling <ProcessPaymentFilter.nextCheckNbr>(e.Row, row.NextCheckNbr, paymenttype.Current != null && paymenttype.Current.PrintOrExport == true && String.IsNullOrEmpty(row.NextCheckNbr) ? new PXSetPropertyException(AP.Messages.NextCheckNumberIsRequiredForProcessing, PXErrorLevel.Warning) : !string.IsNullOrEmpty(row.NextCheckNbr) && !AutoNumberAttribute.CanNextNumber(row.NextCheckNbr) ? new PXSetPropertyException(AP.Messages.NextCheckNumberCanNotBeInc, PXErrorLevel.Warning) : null); if (/*HttpContext.Current != null && */ Filter.Current.BranchID != PXAccess.GetBranchID()) { Filter.Current.BranchID = PXAccess.GetBranchID(); } ProcessPaymentFilter filter = Filter.Current; PaymentMethod pt = paymenttype.Current; ARPaymentList.SetProcessTooltip(Messages.Process); ARPaymentList.SetProcessAllTooltip(Messages.ProcessAll); ARPaymentList.SetProcessDelegate( delegate(List <ARPayment> list) { var graph = CreateInstance <ARProcessPayment>(); graph.ProcessPayments(list, filter, pt); } ); }
protected virtual void HiddenInventoryItem_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { var item = (HiddenInventoryItem)e.Row; if (item == null) { return; } HiddenInventoryItemRUTROT itemRR = PXCache <HiddenInventoryItem> .GetExtension <HiddenInventoryItemRUTROT>(item); Branch branch = PXSelect <GL.Branch, Where <GL.Branch.branchID, Equal <Required <GL.Branch.branchID> > > > .Select(Base, PXAccess.GetBranchID()); BranchRUTROT branchRR = RUTROTHelper.GetExtensionNullable <Branch, BranchRUTROT>(branch); bool allowRUTROT = branchRR?.AllowsRUTROT == true; bool isOtherCostOrNull = itemRR.RUTROTItemType == null || itemRR.RUTROTItemType == RUTROTItemTypes.OtherCost; PXUIFieldAttribute.SetVisible <HiddenInventoryItemRUTROT.rUTROTItemType>(Base.Item.Cache, item, allowRUTROT); PXUIFieldAttribute.SetVisible <HiddenInventoryItemRUTROT.rUTROTType>(Base.Item.Cache, item, allowRUTROT); PXUIFieldAttribute.SetVisible <HiddenInventoryItemRUTROT.rUTROTWorkTypeID>(Base.Item.Cache, item, allowRUTROT); PXUIFieldAttribute.SetEnabled <HiddenInventoryItemRUTROT.rUTROTWorkTypeID>(sender, item, !isOtherCostOrNull); PXUIFieldAttribute.SetEnabled <HiddenInventoryItemRUTROT.rUTROTItemType>(sender, item, true); PXUIFieldAttribute.SetEnabled <HiddenInventoryItemRUTROT.rUTROTType>(sender, item, true); if (!isOtherCostOrNull && !RUTROTHelper.IsUpToDateWorkType(itemRR.RUTROTWorkTypeID, this.Base.Accessinfo.BusinessDate ?? DateTime.Now, this.Base)) { sender.RaiseExceptionHandling <HiddenInventoryItemRUTROT.rUTROTWorkTypeID>(item, itemRR.RUTROTWorkTypeID, new PXSetPropertyException(RUTROTMessages.ObsoleteWorkTypeWarning, PXErrorLevel.Warning)); } else { sender.RaiseExceptionHandling <HiddenInventoryItemRUTROT.rUTROTWorkTypeID>(item, itemRR.RUTROTWorkTypeID, null); } }
protected override FAKeyWithSourceValues EvaluateRawKey(PXGraph graph, FAKeyWithSourceValues keyWithSourceValues) { if (keyWithSourceValues == null) { return(null); } FABook book = BookMaint.FindByID(graph, keyWithSourceValues.SourceBookIDs.First()); if (book == null) { if (keyWithSourceValues.SpecificationItem.IsBookRequired) { return(keyWithSourceValues); } else { book = BookMaint.FindByBookMarker(graph, FABook.bookID.Markers.GLOrAnyBook); } } if (book == null) { return(keyWithSourceValues); } keyWithSourceValues.Key.SetBookID(book); if (book.UpdateGL == true) { if (!PXAccess.FeatureInstalled <FeaturesSet.branch>()) { keyWithSourceValues.KeyOrganizationIDs = PXAccess.GetParentOrganizationID(PXAccess.GetBranchID()).SingleToList(); } else { keyWithSourceValues.KeyOrganizationIDs = keyWithSourceValues.SourceOrganizationIDs; if (IsIDsUndefined(keyWithSourceValues.KeyOrganizationIDs)) { if (!IsIDsUndefined(keyWithSourceValues.SourceBranchIDs)) { keyWithSourceValues.KeyOrganizationIDs = keyWithSourceValues.SourceBranchIDs .Select(branchID => PXAccess.GetParentOrganizationID(branchID)) .ToList(); } else { if (!IsIDsUndefined(keyWithSourceValues.SourceAssetIDs)) { keyWithSourceValues.KeyOrganizationIDs = keyWithSourceValues.SourceAssetIDs .Select(assetID => PXAccess.GetParentOrganizationID(AssetMaint.FindByID(graph, assetID)?.BranchID)) .ToList(); } else if (!PXAccess.FeatureInstalled <FeaturesSet.multipleCalendarsSupport>()) { keyWithSourceValues.KeyOrganizationIDs = ((int?)FABookPeriod.organizationID.NonPostingBookValue).SingleToList(); } } } } } else { keyWithSourceValues.KeyOrganizationIDs = ((int?)FABookPeriod.organizationID.NonPostingBookValue).SingleToList(); } keyWithSourceValues.Key.OrganizationID = keyWithSourceValues.KeyOrganizationIDs.First(); return(keyWithSourceValues); }