Пример #1
0
		protected override IEnumerable Report(PXAdapter adapter,
			[PXString(8, InputMask = "CC.CC.CC.CC")]
			string reportID
			)
		{
			if (!String.IsNullOrEmpty(reportID))
			{
				Save.Press();
				int i = 0;
				Dictionary<string, string> parameters = new Dictionary<string, string>();
				string actualRecoprtID = null;
				foreach (ARInvoice doc in adapter.Get<ARInvoice>())
				{
					parameters["ARInvoice.DocType" + i.ToString()] = doc.DocType;
					parameters["ARInvoice.RefNbr" + i.ToString()] = doc.RefNbr;
					actualRecoprtID = new NotificationUtility(this).SearchReport(ARNotificationSource.Customer, customer.Current, reportID, doc.BranchID);					
					i++;
				}
				if (i > 0)
				{
					throw new PXReportRequiredException(parameters, actualRecoprtID, "Report " + actualRecoprtID);
				}
			}
			return adapter.Get();
		}
Пример #2
0
		public virtual IEnumerable VoidCCPayment(PXAdapter adapter)
		{
			List<ARRegister> list = new List<ARRegister>();
			foreach (ARInvoice item in adapter.Get<ARInvoice>())
			{
				list.Add(item);
				SOInvoice ext = (SOInvoice)SODocument.View.SelectSingleBound(new object[] { item });
				CCPaymentEntry.VoidCCPayment<SOInvoice>(ext, ccProcTran, null, UpdateSOInvoiceState);
			}
			return list;
		}
Пример #3
0
		protected virtual IEnumerable CreditHold(PXAdapter adapter)
		{
			return adapter.Get();
		}
Пример #4
0
		public override IEnumerable Release(PXAdapter adapter)
		{
			List<ARRegister> list = new List<ARRegister>();
			foreach (ARInvoice order in adapter.Get<ARInvoice>())
			{
				list.Add(order);
			}

			if (!IsExternalTax)
			{
				Save.Press();
			}
			else
			{
				try
				{
					skipAvalaraCallOnSave = true;
					Save.Press();
				}
				finally
				{
					skipAvalaraCallOnSave = false;
				}
			}

			PXLongOperation.StartOperation(this, delegate()
			{
				List<ARRegister> listWithTax = new List<ARRegister>();
				if (!IsExternalTax)
				{
					foreach (ARInvoice ardoc in list)
					{
						if (ardoc.IsTaxValid != true && AvalaraMaint.IsExternalTax(this, ardoc.TaxZoneID))
						{
							ARInvoice doc = new ARInvoice();
							doc.DocType = ardoc.DocType;
							doc.RefNbr = ardoc.RefNbr;
							doc.OrigModule = ardoc.OrigModule;
							doc.ApplyPaymentWhenTaxAvailable = ardoc.ApplyPaymentWhenTaxAvailable;
							listWithTax.Add(ARExternalTaxCalc.Process(doc));
						}
						else
						{
							listWithTax.Add(ardoc);
						}
					}
				}
				else
				{
					listWithTax.AddRange(list);
				}

				SOInvoiceEntry ie = PXGraph.CreateInstance<SOInvoiceEntry>();				
				INIssueEntry ingraph = PXGraph.CreateInstance<INIssueEntry>();
				SOOrderShipmentProcess docgraph = PXGraph.CreateInstance<SOOrderShipmentProcess>();
				HashSet<object> processed = new HashSet<object>();
						
				//Field Verification can fail if IN module is not "Visible";therfore suppress it:
				ingraph.FieldVerifying.AddHandler<INTran.projectID>((PXCache sender, PXFieldVerifyingEventArgs e) => { e.Cancel = true; });
				ingraph.FieldVerifying.AddHandler<INTran.taskID>((PXCache sender, PXFieldVerifyingEventArgs e) => { e.Cancel = true; });
				

				ARDocumentRelease.ReleaseDoc(listWithTax, adapter.MassProcess, null, delegate(ARRegister ardoc, bool isAborted)
				{
					List<object> items = new List<object>();
					items.Add(ardoc);
					PXAutomation.RemovePersisted(ie, typeof(ARInvoice), items);

					docgraph.Clear();
					foreach (PXResult<SOOrderShipment, SOOrder> ordershipment in docgraph.Items.View.SelectMultiBound(new object[] { ardoc }))
					{
						SOOrderShipment copy = PXCache<SOOrderShipment>.CreateCopy(ordershipment);
						SOOrder order = ordershipment;
						copy.InvoiceReleased = true;
						docgraph.Items.Update(copy);

						if (order.Completed == true && order.BilledCntr <= 1 && order.ShipmentCntr <= order.BilledCntr + order.ReleasedCntr)
						{
							foreach (SOAdjust adj in docgraph.Adjustments.Select(order.OrderType, order.OrderNbr))
							{
								SOAdjust adjcopy = PXCache<SOAdjust>.CreateCopy(adj);
								adjcopy.CuryAdjdAmt = 0m;
								adjcopy.CuryAdjgAmt = 0m;
								adjcopy.AdjAmt = 0m;
								docgraph.Adjustments.Update(adjcopy);
							}
						}
						processed.Add(ardoc);
					}
					docgraph.Actions.PressSave();
				});
				PXAutomation.StorePersisted(ie, typeof(ARInvoice), new List<object>(processed));
				PXAutomation.CompleteAction(docgraph);				
			});
			return list;
		}
 protected virtual IEnumerable Report(PXAdapter adapter)
 {
     return(adapter.Get());
 }
        public IEnumerable ConsoleRunAction(PXAdapter adapter)
        {
            const string OutputStartTag = "<p style='font-family: Consolas; font-size: 10pt; line-height: 16px'>"; //We should edit the CSS of the editor instead
            const string OutputEndTag   = "</p>";

            try
            {
                var    genericScope      = typeof(ConsoleGlobalScope <>);
                var    typeNotCustomized = PX.Api.CustomizedTypeManager.GetTypeNotCustomized(Base);
                var    typedScopedType   = genericScope.MakeGenericType(typeNotCustomized);
                object typedScope        = Activator.CreateInstance(typedScopedType);
                ((IHaveGraph)typedScope).SetGraph(Base);

                var assemblies = AppDomain.CurrentDomain.GetAssemblies().Where(it => !it.IsDynamic && !it.ReflectionOnly && it.ManifestModule.Name != "<Unknown>");

                //TODO This is also hardcoded in the console JS file
                var imports = new string[] { "System",
                                             "System.Collections",
                                             "System.Collections.Generic",
                                             "System.Linq",
                                             "PX.Data",
                                             "PX.Common",
                                             "PX.Objects.GL",
                                             "PX.Objects.CM",
                                             "PX.Objects.CS",
                                             "PX.Objects.CR",
                                             "PX.Objects.TX",
                                             "PX.Objects.IN",
                                             "PX.Objects.EP",
                                             "PX.Objects.AP",
                                             "PX.TM",
                                             "PX.Objects",
                                             "PX.Objects.PO",
                                             "PX.Objects.SO" };

                ScriptState <object> result;
                if (CurrentState == null || CurrentType != typeNotCustomized || CurrentGraphUID != Base.UID)
                {
                    result = Task.Run(() => CSharpScript.RunAsync <object>(ConsoleView.Current.Input, globalsType: typedScopedType,
                                                                           options: ScriptOptions.Default
                                                                           .WithReferences(assemblies)
                                                                           .WithImports(imports)
                                                                           , globals: typedScope)).Result;

                    CurrentState    = result;
                    CurrentType     = typeNotCustomized;
                    CurrentGraphUID = Base.UID;
                }
                else
                {
                    result = CurrentState.ContinueWithAsync(ConsoleView.Current.Input).Result;
                }

                if (result?.ReturnValue != null)
                {
                    ConsoleView.Cache.SetValueExt <ConsoleFields.output>(ConsoleView.Current, ConsoleView.Current.Output + OutputStartTag + result.ReturnValue.ToString() + OutputEndTag);
                }
                else
                {
                    ConsoleView.Cache.SetValueExt <ConsoleFields.output>(ConsoleView.Current, ConsoleView.Current.Output + OutputStartTag + "Expression has been evaluated and has no value." + OutputEndTag);
                }
            }
            catch (CompilationErrorException ex)
            {
                ConsoleView.Cache.SetValueExt <ConsoleFields.output>(ConsoleView.Current, ConsoleView.Current.Output + OutputStartTag + ex.Message + OutputEndTag);
            }
            catch (AggregateException ae)
            {
                var sb = new System.Text.StringBuilder();
                foreach (Exception ex in ae.InnerExceptions)
                {
                    sb.AppendLine(ex.Message);
                }
                ConsoleView.Cache.SetValueExt <ConsoleFields.output>(ConsoleView.Current, ConsoleView.Current.Output + OutputStartTag + sb.ToString() + OutputEndTag);
            }

            return(adapter.Get());
        }
 public IEnumerable addADUser(PXAdapter adapter)
 {
     ADUser.AskExt();
     return(adapter.Get());
 }
Пример #8
0
 public virtual IEnumerable screenActions(PXAdapter adapter)
 {
     return(adapter.Get());
 }
 protected IEnumerable next(PXAdapter adapter)
 {
     Filter.Current.Year = Filter.Current.Year.Return(_ => (int)_ + 1, DateTime.Today.Year);
     return(adapter.Get());
 }
Пример #10
0
        public virtual IEnumerable LinkLine(PXAdapter adapter)
        {
            Base.checkTaxCalcMode();
            if (Base.Transactions.Current.InventoryID != null)
            {
                Base.Transactions.Cache.ClearQueryCache();                 // for correct PO link detection
                WebDialogResult res;
                if ((res = linkLineFilter.AskExt(
                         (graph, view) =>
                {
                    linkLineFilter.Cache.SetValueExt <LinkLineFilter.inventoryID>(linkLineFilter.Current,
                                                                                  Base.Transactions.Current.InventoryID);
                    linkLineFilter.Current.UOM = Base.Transactions.Current.UOM;
                    linkLineFilter.Current.POOrderNbr = null;
                    linkLineFilter.Current.SiteID = null;

                    APTran apTran = Base.Transactions.Current;

                    linkLineOrderTran.Cache.Clear();             //TODO: closing modal window can't be handled
                    linkLineReceiptTran.Cache.Clear();           //TODO: closing modal window can't be handled
                    linkLineOrderTran.View.Clear();              //TODO: closing modal window can't be handled
                    linkLineReceiptTran.View.Clear();            //TODO: closing modal window can't be handled
                    linkLineOrderTran.Cache.ClearQueryCache();   //TODO: closing modal window can't be handled
                    linkLineReceiptTran.Cache.ClearQueryCache(); //TODO: closing modal window can't be handled
                }, true
                         )) != WebDialogResult.None)
                {
                    if (res == WebDialogResult.Yes &&
                        (linkLineReceiptTran.Cache.Updated.Count() > 0 || linkLineOrderTran.Cache.Updated.Count() > 0))
                    {
                        APTran apTran = Base.Transactions.Current;
                        apTran.ReceiptType        = null;
                        apTran.ReceiptNbr         = null;
                        apTran.ReceiptLineNbr     = null;
                        apTran.POOrderType        = null;
                        apTran.PONbr              = null;
                        apTran.POLineNbr          = null;
                        apTran.POAccrualType      = null;
                        apTran.POAccrualRefNoteID = null;
                        apTran.POAccrualLineNbr   = null;
                        apTran.AccountID          = null;
                        apTran.SubID              = null;

                        if (linkLineFilter.Current.SelectedMode == LinkLineFilter.selectedMode.Receipt)
                        {
                            foreach (POReceiptLineS receipt in linkLineReceiptTran.Cache.Updated)
                            {
                                if (receipt.Selected == true)
                                {
                                    receipt.SetReferenceKeyTo(apTran);
                                    apTran.BranchID  = receipt.BranchID;
                                    apTran.LineType  = receipt.LineType;
                                    apTran.AccountID = receipt.POAccrualAcctID ?? receipt.ExpenseAcctID;
                                    apTran.SubID     = receipt.POAccrualSubID ?? receipt.ExpenseSubID;
                                    break;
                                }
                            }
                        }
                        if (linkLineFilter.Current.SelectedMode == LinkLineFilter.selectedMode.Order)
                        {
                            foreach (POLineS order in linkLineOrderTran.Cache.Updated)
                            {
                                if (order.Selected == true)
                                {
                                    order.SetReferenceKeyTo(apTran);
                                    apTran.BranchID  = order.BranchID;
                                    apTran.LineType  = order.LineType;
                                    apTran.AccountID = order.POAccrualAcctID ?? order.ExpenseAcctID;
                                    apTran.SubID     = order.POAccrualSubID ?? order.ExpenseSubID;
                                    break;
                                }
                            }
                        }
                        Base.Transactions.Cache.Update(apTran);
                        if (string.IsNullOrEmpty(apTran.ReceiptNbr) && string.IsNullOrEmpty(apTran.PONbr))
                        {
                            Base.Transactions.Cache.SetDefaultExt <APTran.accountID>(apTran);
                            Base.Transactions.Cache.SetDefaultExt <APTran.subID>(apTran);
                        }
                    }
                }
            }
            else if (Base.Document.Current != null && Base.Document.Current.LCEnabled == true)
            {
                Base.Transactions.Cache.ClearQueryCache();                 // for correct PO link detection
                WebDialogResult res;
                if ((res = linkLineFilter.AskExt(
                         (graph, view) =>
                {
                    linkLineFilter.Cache.ClearQueryCache();
                    linkLineFilter.View.Clear();
                    linkLineFilter.Cache.Clear();
                    linkLineFilter.Current.SelectedMode = LinkLineFilter.selectedMode.LandedCost;

                    LinkLineLandedCostDetail.Cache.Clear();           //TODO: closing modal window can't be handled
                    LinkLineLandedCostDetail.View.Clear();            //TODO: closing modal window can't be handled
                    LinkLineLandedCostDetail.Cache.ClearQueryCache(); //TODO: closing modal window can't be handled
                }, true
                         )) != WebDialogResult.None)
                {
                    if (res == WebDialogResult.Yes &&
                        (LinkLineLandedCostDetail.Cache.Updated.Count() > 0))
                    {
                        APTran apTran = Base.Transactions.Current;

                        foreach (POLandedCostDetailS detail in LinkLineLandedCostDetail.Cache.Updated)
                        {
                            if (detail.Selected == true)
                            {
                                Base.LinkLandedCostDetailLine(Base.Document.Current, apTran, detail);

                                break;
                            }
                        }
                    }
                }
            }
            return(adapter.Get());
        }
Пример #11
0
 public virtual IEnumerable addNote(PXAdapter adapter)
 {
     return(adapter.Get());
 }
 public virtual IEnumerable reopen(PXAdapter adapter)
 {
     RedirectToStatusProcessing(FinPeriodStatusProcess.FinPeriodStatusProcessParameters.action.Reopen);
     return(adapter.Get());
 }
 public virtual IEnumerable deactivate(PXAdapter adapter)
 {
     RedirectToStatusProcessing(FinPeriodStatusProcess.FinPeriodStatusProcessParameters.action.Deactivate);
     return(adapter.Get());
 }
Пример #14
0
 protected virtual IEnumerable Cancel(PXAdapter adapter)
 {
     CABalValidateList.Cache.Clear();
     TimeStamp = null;
     return(adapter.Get());
 }
 public IEnumerable reloadADUsers(PXAdapter adapter)
 {
     ActiveDirectoryProvider.Instance.Reset();
     ActiveDirectoryProvider.Instance.GetUsers();
     return(adapter.Get());
 }
Пример #16
0
 protected virtual IEnumerable review(PXAdapter adapter) => adapter.Get();
Пример #17
0
 public virtual IEnumerable ViewRemitOnMap(PXAdapter adapter)
 {
     BAccountUtility.ViewOnMap(this.RemitAddress.Current);
     return(adapter.Get());
 }
Пример #18
0
 private static IEnumerable TryChangeActivityType(PXAdapter adapter, PXCache activitiesCache, int newStatus)
 {
     EPActivityGraphHelper.TryChangeType(activitiesCache, newStatus);
     return(adapter.Get());
 }
Пример #19
0
 public virtual IEnumerable ActionsMenu(PXAdapter adapter)
 {
     return(adapter.Get());
 }
Пример #20
0
		public virtual IEnumerable ViewRemitOnMap(PXAdapter adapter)
		{

			BAccountUtility.ViewOnMap(this.RemitAddress.Current);
			return adapter.Get();
		}
Пример #21
0
 public virtual IEnumerable deleteCategory(PXAdapter adapter)
 {
     // ToDo recursive delete
     Caches[typeof(INCategory)].Delete(Folders.Current);
     return(adapter.Get());
 }
Пример #22
0
		public virtual IEnumerable AddShipment(PXAdapter adapter)
		{
			bool RequireControlTotal = ARSetup.Current.RequireControlTotal == true;

			foreach (SOOrderShipment shipment in shipmentlist.Cache.Updated)
			{
				if (shipment.Selected == true)
				{
					foreach (PXResult<SOOrderShipment, SOOrder, CurrencyInfo, SOAddress, SOContact, SOOrderType, SOOrderTypeOperation> order in 
						PXSelectJoin<SOOrderShipment,
						InnerJoin<SOOrder, On<SOOrder.orderType, Equal<SOOrderShipment.orderType>, And<SOOrder.orderNbr, Equal<SOOrderShipment.orderNbr>>>,
						InnerJoin<CurrencyInfo, On<CurrencyInfo.curyInfoID, Equal<SOOrder.curyInfoID>>,
						InnerJoin<SOAddress, On<SOAddress.addressID, Equal<SOOrder.billAddressID>>,
						InnerJoin<SOContact, On<SOContact.contactID, Equal<SOOrder.billContactID>>,
						InnerJoin<SOOrderType, On<SOOrderType.orderType, Equal<SOOrder.orderType>>,
						InnerJoin<SOOrderTypeOperation, 
					         On<SOOrderTypeOperation.orderType, Equal<SOOrder.orderType>,
									And<SOOrderTypeOperation.operation, Equal<SOOrderShipment.operation>>>>>>>>>,
					Where<SOOrderShipment.shipmentNbr, Equal<Current<SOOrderShipment.shipmentNbr>>, And<SOOrderShipment.shipmentType, Equal<Current<SOOrderShipment.shipmentType>>, And<SOOrderShipment.orderType, Equal<Current<SOOrderShipment.orderType>>, And<SOOrderShipment.orderNbr, Equal<Current<SOOrderShipment.orderNbr>>>>>>>.SelectMultiBound(this, new object[] { shipment }))
					{
						ARSetup.Current.RequireControlTotal = false;
						this.InvoiceOrder((DateTime)this.Accessinfo.BusinessDate, order, customer.Current, null);
						ARSetup.Current.RequireControlTotal = RequireControlTotal;
						continue;
					}

					foreach (PXResult<SOOrderReceipt, SOOrder, CurrencyInfo, SOAddress, SOContact, SOOrderType, SOOrderTypeOperation, Customer> res in 
						PXSelectJoin<SOOrderReceipt,
						InnerJoin<SOOrder, On<SOOrder.orderType, Equal<SOOrderReceipt.orderType>, And<SOOrder.orderNbr, Equal<SOOrderReceipt.orderNbr>>>,
						InnerJoin<CurrencyInfo, On<CurrencyInfo.curyInfoID, Equal<SOOrder.curyInfoID>>,
						InnerJoin<SOAddress, On<SOAddress.addressID, Equal<SOOrder.billAddressID>>,
						InnerJoin<SOContact, On<SOContact.contactID, Equal<SOOrder.billContactID>>,
						InnerJoin<SOOrderType, On<SOOrderType.orderType, Equal<SOOrder.orderType>>,						
						InnerJoin<SOOrderTypeOperation, 
					         On<SOOrderTypeOperation.orderType, Equal<SOOrder.orderType>,
									And<SOOrderTypeOperation.operation, Equal<Current<SOOrderShipment.operation>>>>,
						InnerJoin<Customer, On<Customer.bAccountID, Equal<SOOrder.customerID>>>>>>>>>,
					Where<SOOrderReceipt.receiptNbr, Equal<Current<SOOrderShipment.shipmentNbr>>, And<SOShipmentType.dropShip, Equal<Current<SOOrderShipment.shipmentType>>, And<SOOrderReceipt.orderType, Equal<Current<SOOrderShipment.orderType>>, And<SOOrderReceipt.orderNbr, Equal<Current<SOOrderShipment.orderNbr>>>>>>>.SelectMultiBound(this, new object[] { shipment }))
					{
						SOOrderReceipt receipt = res;
						SOOrder order = res;

						PXResultset<SOShipLine, SOLine> details = new PXResultset<SOShipLine, SOLine>();

						foreach (PXResult<POReceiptLine, SOLine> line in PXSelectJoin<POReceiptLine,
							InnerJoin<SOLine, On<SOLine.pOType, Equal<POReceiptLine.pOType>, And<SOLine.pONbr, Equal<POReceiptLine.pONbr>, And<SOLine.pOLineNbr, Equal<POReceiptLine.pOLineNbr>>>>>,
							Where2<Where<POReceiptLine.lineType, Equal<POLineType.goodsForDropShip>, Or<POReceiptLine.lineType, Equal<POLineType.nonStockForDropShip>>>, And<POReceiptLine.receiptNbr, Equal<Current<SOOrderReceipt.receiptNbr>>, And<SOLine.orderType, Equal<Current<SOOrderReceipt.orderType>>, And<SOLine.orderNbr, Equal<Current<SOOrderReceipt.orderNbr>>>>>>>.SelectMultiBound(this, new object[] { receipt }))
						{
							details.Add(new PXResult<SOShipLine, SOLine>((SOShipLine)line, line));
						}

						shipmentlist.Cache.SetStatus(shipment, PXEntryStatus.Notchanged);
						shipmentlist.Cache.Remove(shipment);

						ARSetup.Current.RequireControlTotal = false;
						this.InvoiceOrder((DateTime)this.Accessinfo.BusinessDate, new PXResult<SOOrderShipment, SOOrder, CurrencyInfo, SOAddress, SOContact, SOOrderType, SOOrderTypeOperation>((PXResult<SOOrderReceipt, SOOrder>)res, order, (CurrencyInfo)res, (SOAddress)res, (SOContact)res, (SOOrderType)res, (SOOrderTypeOperation)res), details, (Customer)res, null);
						ARSetup.Current.RequireControlTotal = RequireControlTotal;
					}
				}
				else if (shipment.InvoiceNbr == null)
				{
					shipmentlist.Cache.SetStatus(shipment, PXEntryStatus.Notchanged);
					shipmentlist.Cache.Remove(shipment);
				}
			}

			shipmentlist.View.Clear();
			//shipmentlist.Cache.Clear(); 
			return adapter.Get();
		}
Пример #23
0
 public virtual IEnumerable viewTask(PXAdapter adapter)
 {
     editDetail();
     return(adapter.Get());
 }
Пример #24
0
		protected virtual IEnumerable Flow(PXAdapter adapter)
		{
			Save.Press();					
			return adapter.Get();
		}
Пример #25
0
 protected virtual IEnumerable Action(PXAdapter adapter)
 {
     return(adapter.Get());
 }
Пример #26
0
		protected virtual IEnumerable Post(PXAdapter adapter)
		{
			List<ARRegister> list = new List<ARRegister>();
			foreach (ARInvoice order in adapter.Get<ARInvoice>())
			{
				list.Add(order);
			}

			Save.Press();

			PXLongOperation.StartOperation(this, delegate()
			{
				SOInvoiceEntry ie = PXGraph.CreateInstance<SOInvoiceEntry>();
				INIssueEntry ingraph = PXGraph.CreateInstance<INIssueEntry>();
				ingraph.FieldVerifying.AddHandler<INTran.inventoryID>((PXCache sender, PXFieldVerifyingEventArgs e) => { e.Cancel = true; });
				ingraph.FieldVerifying.AddHandler<INTran.projectID>((PXCache sender, PXFieldVerifyingEventArgs e) => { e.Cancel = true; });
				ingraph.FieldVerifying.AddHandler<INTran.taskID>((PXCache sender, PXFieldVerifyingEventArgs e) => { e.Cancel = true; });
				DocumentList<INRegister> inlist = new DocumentList<INRegister>(ingraph);

				bool failed = false;

				foreach (ARInvoice ardoc in list)
				{
					try
					{
						ie.PostInvoice(ingraph, ardoc, inlist);

						if (adapter.MassProcess)
						{
							PXProcessing<ARInvoice>.SetInfo(list.IndexOf(ardoc), ActionsMessages.RecordProcessed);
						}
					}
					catch (Exception ex)
					{
						if (!adapter.MassProcess)
						{
							throw;
						}
						PXProcessing<ARInvoice>.SetError(list.IndexOf(ardoc), ex);
						failed = true;
					} 
				}

				if (ie.sosetup.Current.AutoReleaseIN == true && inlist.Count > 0 && inlist[0].Hold == false)
				{
					INDocumentRelease.ReleaseDoc(inlist, false);
				}

				if (failed)
				{
					throw new PXOperationCompletedException(ErrorMessages.SeveralItemsFailed);
				}
			});

			return adapter.Get();
		}
 public virtual IEnumerable restoreFromArchive(PXAdapter adapter)
 {
     PXLongOperation.StartOperation(this, () => RestoreFromArchiveMessages(SelectedList().RowCast <CRSMEmail>()));
     return(adapter.Get());
 }
Пример #28
0
		public virtual IEnumerable CaptureCCPayment(PXAdapter adapter)
		{
			List<ARRegister> list = new List<ARRegister>();
			foreach (ARInvoice item in adapter.Get<ARInvoice>())
			{
				list.Add(item);
				SOInvoice ext = (SOInvoice) SODocument.View.SelectSingleBound(new object[] { item });
				CCPaymentEntry.ReleaseDelegate releaseDelegate = null;
				CCPaymentEntry.UpdateDocStateDelegate docStateDelegate = UpdateSOInvoiceState;
				CCPaymentEntry.CaptureCCPayment<SOInvoice>(ext, this.ccProcTran, releaseDelegate, docStateDelegate);
			}

			return list;
		}
 protected virtual IEnumerable Flow(PXAdapter adapter)
 {
     Save.Press();
     return(adapter.Get());
 }
Пример #30
0
		public virtual IEnumerable CreditCCPayment(PXAdapter adapter)
		{
			foreach (ARInvoice doc in adapter.Get<ARInvoice>())
			{
				SOInvoice ext = (SOInvoice)SODocument.View.SelectSingleBound(new object[] { doc });
				string PCRefTranNbr = ext.RefTranExtNbr;
				if (String.IsNullOrEmpty(ext.RefTranExtNbr))
				{
					this.SODocument.Cache.RaiseExceptionHandling<SOOrder.refTranExtNbr>(ext, ext.RefTranExtNbr, new PXSetPropertyException(AR.Messages.ERR_PCTransactionNumberOfTheOriginalPaymentIsRequired));
				}
				else
				{
					CCPaymentEntry.CreditCCPayment<SOInvoice>(ext, PCRefTranNbr, ccProcTran, null, UpdateSOInvoiceState);
				}
			}
			return adapter.Get();
		}
 protected override IEnumerable ProcessAll(PXAdapter adapter)
 {
     return(!CheckCustomer(adapter, false) ? adapter.Get() : base.ProcessAll(adapter));
 }
Пример #32
0
 public virtual IEnumerable markAsUnread(PXAdapter adapter)
 {
     PXLongOperation.StartOperation(this, () => MarkAs(adapter, EPViewStatusAttribute.NOTVIEWED, SelectedList()));
     return(adapter.Get());
 }
        private IEnumerable PerformPaste(PXAdapter adapter)
        {
            var buffer = CutBuffer.Cache.Cached.Cast <ItemBuffer>().ToArray();

            if (buffer.Any() == false)
            {
                return(adapter.Get());
            }

            int newItemClassID = (int)ItemClasses.Current.ItemClassID;

            object[] inventoryIDs = buffer.Select(b => b.InventoryID).Cast <object>().ToArray();
            var      inventories  =
                PXSelectReadonly <InventoryItem,
                                  Where <InventoryItem.inventoryID, In <Required <InventoryItem.inventoryID> > > >
                .Select(this, new[] { inventoryIDs }).RowCast <InventoryItem>().ToArray();

            var notMatchItems = inventories.Where(i => i.StkItem != ItemClasses.Current.StkItem).ToArray();

            if (notMatchItems.Any())
            {
                String segmentedItemClassID = ItemClasses.Current.SegmentedClassCD.Split(' ').First();
                if (notMatchItems.Length == 1)
                {
                    throw new PXInvalidOperationException(
                              Messages.ItemClassAndInventoryItemStkItemShouldBeSameSingleItem,
                              notMatchItems[0].InventoryCD.TrimEnd(),
                              segmentedItemClassID);
                }
                else
                {
                    PXTrace.WriteInformation(
                        notMatchItems.Aggregate(
                            new StringBuilder().AppendLine(PXMessages.LocalizeFormatNoPrefix(Messages.CouldNotBeMovedToItemClassItemsList, segmentedItemClassID)),
                            (sb, item) => sb.AppendLine(item.InventoryCD.TrimEnd()),
                            sb => sb.ToString()));

                    throw new PXInvalidOperationException(
                              Messages.ItemClassAndInventoryItemStkItemShouldBeSameManyItems,
                              segmentedItemClassID);
                }
            }

            bool needToDefault = Inventories.Ask(AR.Messages.Warning, Messages.ItemClassChangeWarning, MessageButtons.YesNo) == WebDialogResult.Yes;

            Lazy <InventoryItemMaint> stockItemMaint    = new Lazy <InventoryItemMaint>(CreateInstance <InventoryItemMaint>);
            Lazy <NonStockItemMaint>  nonStockItemMaint = new Lazy <NonStockItemMaint>(CreateInstance <NonStockItemMaint>);

            foreach (InventoryItem inventory in inventories)
            {
                if (needToDefault)
                {
                    if (inventory.StkItem == true)
                    {
                        stockItemMaint.Value.Item.Current = inventory;
                        using (stockItemMaint.Value.MakeRuleWeakeningScopeFor <InventoryItem.baseUnit>(RuleWeakenLevel.SuppressError))
                        {
                            stockItemMaint.Value.Item.Cache.SetValueExt <InventoryItem.itemClassID>(inventory, newItemClassID);
                            stockItemMaint.Value.Item.Update(inventory);
                        }
                        stockItemMaint.Value.Actions.PressSave();
                    }
                    else
                    {
                        nonStockItemMaint.Value.Item.Current = inventory;
                        using (nonStockItemMaint.Value.MakeRuleWeakeningScopeFor <InventoryItem.baseUnit>(RuleWeakenLevel.SuppressError))
                        {
                            nonStockItemMaint.Value.Item.Cache.SetValueExt <InventoryItem.itemClassID>(inventory, newItemClassID);
                            nonStockItemMaint.Value.Item.Update(inventory);
                        }
                        nonStockItemMaint.Value.Actions.PressSave();
                    }
                }
                else
                {
                    inventory.ItemClassID = newItemClassID;
                    Inventories.Cache.Update(inventory);
                }
                Inventories.SetValueExt <InventoryItem.selected>(Inventories.Locate(inventory), false);
            }

            CutBuffer.Cache.Clear();

            if (needToDefault)
            {
                Actions.PressCancel();
            }
            else
            {
                Actions.PressSave();
            }

            return(adapter.Get());
        }
Пример #34
0
 public virtual IEnumerable delete(PXAdapter adapter)
 {
     PXLongOperation.StartOperation(this, () => DeleteMessage(SelectedList().RowCast <CRSMEmail>()));
     return(adapter.Get());
 }
 protected virtual IEnumerable Cancel(PXAdapter adapter)
 {
     ARTempCreditLimitRecord.Cache.Clear();
     TimeStamp = null;
     return(adapter.Get());
 }
 public virtual IEnumerable FilterManually(PXAdapter adapter)
 {
     RouteAppointmentGPSLocationFilter.Current.LoadData = true;
     return(adapter.Get());
 }
Пример #37
0
        public virtual IEnumerable close(PXAdapter adapter)
        {
            APSetup apSetup = APSetup.Select();
            ARSetup arSetup = ARSetup.Select();
            INSetup inSetup = INSetup.Select();
            CASetup caSetup = CASetup.Select();
            FASetup faSetup = FASetup.Select();

            List <FinPeriod> list = new List <FinPeriod>();

            bool YearClosed = true;

            foreach (FinPeriod period in adapter.Get())
            {
                if (period.Selected == true)
                {
                    if (period.Active != true)
                    {
                        throw new FiscalPeriodInactiveException(period.FinPeriodID);
                    }

                    if (Accessinfo.ScreenID == "GL.50.30.00")
                    {
                        if (apSetup != null && (period.APClosed != true))
                        {
                            throw new PXException(Messages.PeriodOpenInAPModule);
                        }
                        if (arSetup != null && (period.ARClosed != true))
                        {
                            throw new PXException(Messages.PeriodOpenInARModule);
                        }
                        if (caSetup != null && (period.CAClosed != true))
                        {
                            throw new PXException(Messages.PeriodOpenInCAModule);
                        }
                        if (inSetup != null && (period.INClosed != true))
                        {
                            throw new PXException(Messages.PeriodOpenInINModule);
                        }
                        if (faSetup != null && (period.FAClosed != true))
                        {
                            throw new PXException(Messages.PeriodOpenInFAModule);
                        }
                    }

                    list.Add(period);
                }
                else
                {
                    YearClosed = false;
                }
            }

            if (YearClosed)
            {
                if ((FinPeriod)NextFiscalYear.Select(list[list.Count - 1].FinYear) == null)
                {
                    throw new PXException(Messages.NoPeriodsForNextYear);
                }
            }

            if (list.Count > 0)
            {
                StartClosePeriod(list);
            }
            return(adapter.Get());
        }
Пример #38
0
 protected virtual IEnumerable actionsFolder(PXAdapter adapter)
 {
     return(adapter.Get());
 }
Пример #39
0
        public virtual IEnumerable syncUsers(PXAdapter adapter)
        {
            Console.WriteLine("Sync users");

            return(adapter.Get());
        }
Пример #40
0
        public virtual IEnumerable showAssets(PXAdapter adapter)
        {
            string minPeriod = null, maxPeriod = null;
            foreach (FinPeriod period in adapter.Get())
            {
                if (period.Selected == true)
                {
                    if(string.IsNullOrEmpty(minPeriod) || string.Compare(period.FinPeriodID, minPeriod) < 0)
                    {
                        minPeriod = period.FinPeriodID;
                    }
                    if (string.IsNullOrEmpty(maxPeriod) || string.Compare(period.FinPeriodID, maxPeriod) > 0)
                    {
                        maxPeriod = period.FinPeriodID;
                    }
                }
            }

            Dictionary<string, string> d = new Dictionary<string, string>();

            d["PeriodFrom"] = minPeriod.Substring(4, 2) + minPeriod.Substring(0, 4);
            d["PeriodTo"] = maxPeriod.Substring(4, 2) + maxPeriod.Substring(0, 4);
            const string ReportID = "FA652000";
            throw new PXReportRequiredException(d, ReportID, PXBaseRedirectException.WindowMode.New, "Active Fixed Assets");
        }
Пример #41
0
		public virtual IEnumerable AddShipmentCancel(PXAdapter adapter)
		{
			foreach (SOOrderShipment shipment in shipmentlist.Cache.Updated)
			{
				if (shipment.InvoiceNbr == null)
				{
					shipmentlist.Cache.SetStatus(shipment, PXEntryStatus.Notchanged);
					shipmentlist.Cache.Remove(shipment);
				}
			}

			shipmentlist.View.Clear();
			//shipmentlist.Cache.Clear();
			return adapter.Get();
		}
Пример #42
0
		public override  IEnumerable ValidateAddresses(PXAdapter adapter)
		{
			Location main = this.Location.Current;
			if (main != null)
			{
				bool needSave = false;
				Save.Press();
				Address address = this.Address.Current;
				if (address != null && address.IsValidated == false)
				{
					if (CS.PXAddressValidator.Validate<Address>(this, address, true))
						needSave = true;
				}

				Address remitAddress = this.RemitAddress.Current;
				if (remitAddress != null && remitAddress.IsValidated == false && (remitAddress.AddressID != address.AddressID))
				{
					if (CS.PXAddressValidator.Validate<Address>(this, remitAddress, true))
						needSave = true;
				}
				if (needSave == true)
					this.Save.Press();

			}
			return adapter.Get();
		}
 public IEnumerable ConsoleClearOutputAction(PXAdapter adapter)
 {
     ConsoleView.Cache.SetValueExt <ConsoleFields.output>(ConsoleView.Current, String.Empty);
     CurrentState = null;
     return(adapter.Get());
 }