Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
################################################################################
# This .gitignore file was automatically created by Microsoft(R) Visual Studio.
################################################################################

/.vs
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ To use this customziation:
![Screenshot](/_ReadMeImages/AR302000d.png)
- Clicking on Reports -> Print Refund Check will assign the next check number to 'Payment Ref' and Payment Method (CA204000) -> AR Last Reference Number for matching Cash Account used. And also it will redirect to refund check form report AR640501.rpx.
![Screenshot](/_ReadMeImages/AR302000e.png)
- There is no batch printing capability of refund checks.
- If you want to use the AP Check numbering sequence for customer refunds, check "Use AP Reference Nbr for AR"
![Screenshot](/_ReadMeImages/AR302000f.png)
- If you want to print multiple checks at once, navigate to AR508800 "Print customer Refunds"
![Screenshot](/_ReadMeImages/AR508800a.png)
- After clicking "Process", the selected checks will be displayed in the report browser
![Screenshot](/_ReadMeImages/AR508800b.png)

Known Issues
------------
Expand Down
Binary file modified _ReadMeImages/AR302000a.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _ReadMeImages/AR302000f.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _ReadMeImages/AR508800a.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _ReadMeImages/AR508800b.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions cust/PrintCustomerRefundPkg/Pages/AR/AR508800.aspx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<%@ Page Language="C#" MasterPageFile="~/MasterPages/FormDetail.master" AutoEventWireup="true" ValidateRequest="false" CodeFile="AR508800.aspx.cs" Inherits="Page_AR508800" Title="Untitled Page" %>
<%@ MasterType VirtualPath="~/MasterPages/FormDetail.master" %>

<asp:Content ID="cont1" ContentPlaceHolderID="phDS" Runat="Server">
<px:PXDataSource ID="ds" runat="server" Visible="True" Width="100%"
TypeName="PX.PrintCustomerRefund.Ext.CustomerRefundMassPrint"
PrimaryView="Filter">
<CallbackCommands>

</CallbackCommands>
</px:PXDataSource>
</asp:Content>
<asp:Content ID="cont2" ContentPlaceHolderID="phF" Runat="Server">
<px:PXFormView ID="form" runat="server" DataSourceID="ds" DataMember="Filter" Width="100%" AllowAutoHide="false">
<Template>
<px:PXLayoutRule runat="server" StartRow="True"/>
<px:PXSelector runat="server" ID="slBranchID" DataField="BranchID" CommitChanges="True"/>
<px:PXSelector runat="server" ID="slPaymentMethodID" DataField="PaymentMethodID" CommitChanges="True" AutoRefresh="True"/>
<px:PXSelector runat="server" ID="slCashAccountID" DataField="CashAccountID" CommitChanges="True" AutoRefresh="True"/>
<px:PXTextEdit runat="server" ID="txtLastCheckNbr" DataField="LastCheckNbr" CommitChanges="True"/>

<px:PXLayoutRule runat="server" StartColumn="True"/>
<px:PXCheckBox runat="server" ID="chkSetApplicationDate" DataField="SetApplicationDate" CommitChanges="True"/>
</Template>
<AutoSize Enabled="true" Container="Window" />
</px:PXFormView>
</asp:Content>
<asp:Content ID="cont3" ContentPlaceHolderID="phG" Runat="Server">
<px:PXGrid ID="grid" runat="server" DataSourceID="ds" Width="100%" Height="150px" SkinID="Details" AllowAutoHide="false">
<Levels>
<px:PXGridLevel DataMember="Refunds">
<Columns>
<px:PXGridColumn DataField="Selected" Type="CheckBox" TextAlign="Center"/>
<px:PXGridColumn DataField="RefNbr"/>
<px:PXGridColumn DataField="CustomerID"/>
<px:PXGridColumn DataField="AdjDate"/>
<px:PXGridColumn DataField="CuryOrigDocAmt"/>
</Columns>
</px:PXGridLevel>
</Levels>
<AutoSize Container="Window" Enabled="True" MinHeight="150"/>
<ActionBar >
</ActionBar>
</px:PXGrid>
</asp:Content>
15 changes: 15 additions & 0 deletions cust/PrintCustomerRefundPkg/Pages/AR/AR508800.aspx.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

public partial class Page_AR508800 : PX.Web.UI.PXPage
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
153 changes: 153 additions & 0 deletions cust/PrintCustomerRefundPkg/_project/Code_ARPaymentEntryExt.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
<Graph ClassName="ARPaymentEntryExt" Source="#CDATA" IsNew="True" FileType="NewFile">
<CDATA name="Source"><![CDATA[using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PX.Data;
using PX.Objects.AR;
using PX.Objects.CA;
using PX.Objects.CS;
using System.Collections;

namespace PX.PrintCustomerRefund.Ext
{
// Acuminator disable once PX1016 ExtensionDoesNotDeclareIsActiveMethod extension should be constantly active
public class ARPaymentEntryExt : PXGraphExtension<ARPaymentEntry>
{
public PXSelect<PaymentMethodAccount,
Where<PaymentMethodAccount.cashAccountID, Equal<Current<ARPayment.cashAccountID>>>,
OrderBy<Asc<PaymentMethodAccount.aRIsDefault>>> CashAcctDetail_AccountID;

public PXSelect<PaymentMethodAccount, Where<
Where<PaymentMethodAccount.cashAccountID, Equal<Current<ARPayment.cashAccountID>>,
And<PaymentMethodAccount.paymentMethodID, Equal<Current<ARPayment.paymentMethodID>>>>>> cashaccountdetail;

public override void Initialize()
{
Base.report.AddMenuAction(printRefundCheck);
printRefundCheck.SetEnabled(false);
}

public PXAction<ARPayment> printRefundCheck;
[PXButton()]
[PXUIField(DisplayName = "Print Refund Check", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
protected virtual void PrintRefundCheck()
{
AssignCheckNumber();

Dictionary<string, string> d = new Dictionary<string, string>()
{
["StartCheckNbr"] = Base.Document.Current.ExtRefNbr,
["PaymentMethodID"] = Base.Document.Current.PaymentMethodID,
["CashAccountID"] = CashAccount.PK.Find(Base, Base.Document.Current.CashAccountID).CashAccountCD,
[PX.Objects.AP.ReportMessages.CheckReportFlag] = PX.Objects.AP.ReportMessages.CheckReportFlagValue
};

var requiredException = new PXReportRequiredException(d, "AR640501", PXBaseRedirectException.WindowMode.New, "Refund Check");


throw new PXRedirectWithReportException(this.Base, requiredException, "Preview");
}

protected virtual void ARPayment_ExtRefNbr_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e, PXFieldDefaulting BaseInvoke)
{
if (BaseInvoke != null)
BaseInvoke(sender, e);
ARPayment data = (ARPayment)e.Row;
PaymentMethod pmRow = Base.paymentmethod.Current;
if (data == null || pmRow == null) return;
if (!(data.DocType == ARDocType.Refund
&& pmRow.PaymentType == PaymentMethodType.CashOrCheck)) return;
e.NewValue = null;
e.Cancel = true;
}

protected virtual void ARPayment_ExtRefNbr_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e, PXFieldVerifying BaseInvoke)
{
if (BaseInvoke != null)
BaseInvoke(sender, e);
ARPayment data = (ARPayment)e.Row;
PaymentMethod pmRow = Base.paymentmethod.Current;

if (
!(data == null
|| pmRow == null
|| String.IsNullOrEmpty(data.ExtRefNbr))
&& (
data.DocType == ARDocType.Refund
&& pmRow.PaymentType == PaymentMethodType.CashOrCheck
&& data.ExtRefNbr.ToUpper() == MessageConst._TOBEGEN.ToUpper()
))
e.Cancel = true;
}

protected void ARPayment_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
{
ARPayment row = e.Row as ARPayment;
PaymentMethod pmRow = Base.paymentmethod.Current;
if (row == null || pmRow == null) return;

bool bPrint = ((row.DocType == ARDocType.Refund) && (pmRow.PaymentType == PaymentMethodType.CashOrCheck));
printRefundCheck.SetEnabled(bPrint && !row.Released.Value && !row.Hold.Value);
PXUIFieldAttribute.SetEnabled<ARPayment.extRefNbr>(sender, row, !bPrint);
}

protected virtual void ARPayment_RowPersisting(PXCache sender, PXRowPersistingEventArgs e, PXRowPersisting del)
{
ARPayment row = e.Row as ARPayment;
PaymentMethod pmRow = Base.paymentmethod.Current;
if (row == null || pmRow == null) return;

if ((row.DocType == ARDocType.Refund) &&
(pmRow.PaymentType == PaymentMethodType.CashOrCheck) &&
(String.IsNullOrEmpty(row.ExtRefNbr)))
{
row.ExtRefNbr = MessageConst._TOBEGEN;
}

if (del != null)
del(sender, e);
}

public void AssignCheckNumber()
{
ARPayment row = Base.Document.Current;
PaymentMethod pmRow = Base.paymentmethod.Current;

if (row != null && pmRow != null)
{
if ((row.DocType == ARDocType.Refund) && (pmRow.PaymentType == PaymentMethodType.CashOrCheck))
{
cashaccountdetail.Cache.ClearQueryCache();
PaymentMethodAccount det = this.cashaccountdetail.Select();
bool useAp = det.GetExtension<PaymentMethodExt>().UsrUseAPReferenceNbrForArRefund.GetValueOrDefault();
string lastRefNbr = useAp ? det.APLastRefNbr : det.ARLastRefNbr;

if ((String.IsNullOrEmpty(row.ExtRefNbr)
|| (row.ExtRefNbr.Trim().ToUpper() == MessageConst._TOBEGEN.ToUpper()))
&& (!String.IsNullOrEmpty(lastRefNbr)))
{
row.ExtRefNbr = AutoNumberAttribute.NextNumber(lastRefNbr);
Base.Document.Update(row);

if (useAp)
{
det.APLastRefNbr = row.ExtRefNbr;
}
else
{
det.ARLastRefNbr = row.ExtRefNbr;
}
this.cashaccountdetail.Update(det);

row.Status = ARDocStatus.Open;
Base.Document.Update(row);

Base.Actions.PressSave();
}
}
}
}
}
}]]></CDATA>
</Graph>
33 changes: 33 additions & 0 deletions cust/PrintCustomerRefundPkg/_project/Code_ARPaymentExt.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<Graph ClassName="ARPaymentExt" Source="#CDATA" IsNew="True" FileType="NewGraph">
<CDATA name="Source"><![CDATA[using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PX.Data;
using PX.Objects.AR;
using PX.Objects.CA;

namespace PX.PrintCustomerRefund.Ext
{
public class ARPaymentExt : PXCacheExtension<ARPayment>
{
#region AmountToWords
public abstract class amountToWords : IBqlField { }
protected string _AmountToWords;
[PX.Objects.AP.ToWords(typeof(ARPayment.curyOrigDocAmt))]
public virtual string AmountToWords
{
get
{
return this._AmountToWords;
}
set
{
this._AmountToWords = value;
}
}
#endregion
}
}
]]></CDATA>
</Graph>
37 changes: 37 additions & 0 deletions cust/PrintCustomerRefundPkg/_project/Code_ARReleaseProcessExt.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<Graph ClassName="ARReleaseProcessExt" Source="#CDATA" IsNew="True" FileType="NewFile">
<CDATA name="Source"><![CDATA[using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PX.Data;
using PX.Objects.AR;
using PX.Objects.GL;

namespace PX.PrintCustomerRefund.Ext
{
public class ARReleaseProcessExt : PXGraphExtension<ARReleaseProcess>
{
public delegate List<ARRegister> ReleaseDocProcBaseDelegate(JournalEntry je, ARRegister ardoc, List<Batch> pmBatchList,
ARDocumentRelease.ARMassProcessReleaseTransactionScopeDelegate onreleasecomplete);

[PXOverride]
public List<ARRegister> ReleaseDocProc(JournalEntry je, ARRegister ardoc, List<Batch> pmBatchList,
ARDocumentRelease.ARMassProcessReleaseTransactionScopeDelegate onreleasecomplete,
ReleaseDocProcBaseDelegate BaseInvoke)
{
if (ardoc is ARPayment)
{
ARPayment currentPayment = ardoc as ARPayment;
if (currentPayment.DocType == ARDocType.Refund
&& (String.IsNullOrEmpty(currentPayment.ExtRefNbr)
|| currentPayment.ExtRefNbr.Trim().ToUpper() == MessageConst._TOBEGEN.ToUpper())
)
{
throw new PXException(MessageConst._CHECK_NOTPRINTED_CANNOTRELEASE);
}
}
return BaseInvoke(je, ardoc, pmBatchList, onreleasecomplete);
}
}
}]]></CDATA>
</Graph>
Loading