Skip to main content
Question

Changing sort order of check printing on Process Payments / Print Checks screen


Joe Schmucker
Captain II
Forum|alt.badge.img+3

I want to change the sort order when printing checks from RefNbr to Vendor AcctCD.  

In my override, I am adding one additional line to the select statement.  If I use the original code, it works normally.  If I use my code which only adds this line to the statement: OrderBy<Asc<Vendor.acctCD», the process screen “resets” after you select the payment method “Check”.  

	public class APPrintChecks_Extension : PXGraphExtension<PX.Objects.AP.APPrintChecks>
	{
		[PXOverride]
		public virtual IEnumerable GetAPPaymentList()
		{
			//Original
			//var cmd = new PXSelectJoin<APPayment,
			//	InnerJoinSingleTable<Vendor, On<Vendor.bAccountID, Equal<APPayment.vendorID>>,
			//	InnerJoin<PaymentMethod, On<PaymentMethod.paymentMethodID, Equal<APPayment.paymentMethodID>>,
			//	LeftJoin<CABatchDetail, On<CABatchDetail.origModule, Equal<BatchModule.moduleAP>,
			//			And<CABatchDetail.origDocType, Equal<APPayment.docType>,
			//			And<CABatchDetail.origRefNbr, Equal<APPayment.refNbr>>>>>>>,
			//	Where2<Where<APPayment.status, Equal<APDocStatus.pendingPrint>,
			//		And<CABatchDetail.batchNbr, IsNull,
			//		And<APPayment.cashAccountID, Equal<Current<PrintChecksFilter.payAccountID>>,
			//		And<APPayment.paymentMethodID, Equal<Current<PrintChecksFilter.payTypeID>>,
			//		And<Match<Vendor, Current<AccessInfo.userName>>>>>>>,
			//		And<APPayment.docType, In3<APDocType.check, APDocType.prepayment, APDocType.quickCheck>>>>(Base);

			//Modified
			var cmd = new PXSelectJoin<APPayment,
				InnerJoinSingleTable<Vendor, On<Vendor.bAccountID, Equal<APPayment.vendorID>>,
				InnerJoin<PaymentMethod, On<PaymentMethod.paymentMethodID, Equal<APPayment.paymentMethodID>>,
				LeftJoin<CABatchDetail, On<CABatchDetail.origModule, Equal<BatchModule.moduleAP>,
						And<CABatchDetail.origDocType, Equal<APPayment.docType>,
						And<CABatchDetail.origRefNbr, Equal<APPayment.refNbr>>>>>>>,
				Where2<Where<APPayment.status, Equal<APDocStatus.pendingPrint>,
					And<CABatchDetail.batchNbr, IsNull,
					And<APPayment.cashAccountID, Equal<Current<PrintChecksFilter.payAccountID>>,
					And<APPayment.paymentMethodID, Equal<Current<PrintChecksFilter.payTypeID>>,
					And<Match<Vendor, Current<AccessInfo.userName>>>>>>>,
					And<APPayment.docType, In3<APDocType.check, APDocType.prepayment, APDocType.quickCheck>>>,
				OrderBy<Asc<Vendor.acctCD>>>(Base);
			foreach (PXResult<APPayment, Vendor, PaymentMethod, CABatchDetail> doc in cmd.SelectWithViewContext())
			{
				yield return new PXResult<APPayment, Vendor>(PXCache<APPayment>.CreateCopy(doc), doc);
			}
		}

Why would adding an OrderBy statement cause this select statement to fail?

7 replies

darylbowman
Captain II
Forum|alt.badge.img+13

I have another suggestion:

public override void Initialize()
{
    Base.APPaymentList.OrderByNew<OrderBy<Asc<Vendor.acctCD, Asc<APPayment.refNbr>>>>();
}

 


Joe Schmucker
Captain II
Forum|alt.badge.img+3
  • Author
  • Captain II
  • 443 replies
  • June 6, 2024

Thanks @darylbowman .   I’ll give that a try! 

 


Joe Schmucker
Captain II
Forum|alt.badge.img+3
  • Author
  • Captain II
  • 443 replies
  • June 6, 2024

@darylbowman The code compiles and does not cause any runtime errors.  However, it does the same thing as my code did.  When you select Checks from the Payment Method drop down list, the field gets cleared and the screen appears as it does when you first open it.

I’ve told the customer that this is probably just not doable.  Please don’t spend any extra time on this on my behalf.  I appreciate your suggestion anyway.  I’m kind of glad the result was the same as my code as it indicates there is something going on inside that graph that just doesn’t like me trying to add a sort by. 


darylbowman
Captain II
Forum|alt.badge.img+13

This works fine in 24 R1. It may be something instance specific?


Joe Schmucker
Captain II
Forum|alt.badge.img+3
  • Author
  • Captain II
  • 443 replies
  • June 6, 2024

I’ve seen a bunch of other comments in this forum.  A lot of companies are having this issue starting a couple years ago.  Maybe this will be encouragement for them to upgrade to 2024.  I suppose they will just need to suffer through it until they get on the current version.

 

Funny thing is that in my local 2023R1, if I sort the grid on the vendor id, it prints the checks in that order for ME.  But it does not work for the customer (according to them anyway).  They even provided print screens to support that.  It might even be something down to the build number as opposed to the overall release version.


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • 2657 replies
  • July 25, 2024

Hi @Joe Schmucker were you able to find a solution? Thank you!


Joe Schmucker
Captain II
Forum|alt.badge.img+3
  • Author
  • Captain II
  • 443 replies
  • July 25, 2024

Hi @Chris Hackett  I was not able to find a solution.  If I recall, this might be resolved in 24R1.  Strangely, when I changed the sort order in the list of checks to print, they sorted when printed, but it did not work on the customer’s instance.  

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings