How to add aging hold and credit hold shapes to customer maintenance (and maybe other screens)?

In Sales Order Entry, if the customer is on credit hold there is a red shape that appears:
so_CH

If there is no credit hold this shape is invisible (does not appear).

In the customization I see where this is defined:

So I tried to mimic this is Customer Maintenance. I couldn’t find a boolean field for credit holds, but I did find one for aging holds:

I also created a checkbox with the same EpiBinding (not shown).

Here are what the shape and checkbox look like for a customer with an Aging Hold:
cust_ah1

Ok, first of all, why is the shape green? This was the default but I changed it to red! (I tried closing and reopening the screen, to no effect.) The checkbox is checked as expected.

But here is what the shape and checkbox look like when I open a customer WITHOUT an Aging Hold:
cust_ah0

The checkbox is unchecked as expected, but why is the shape still there?

When no customer is loaded, the shape is grayed. I also don’t expect this because I set visible to False.

What am I doing wrong?

Also, how can I get a shape for Credit Hold given that Customer doesn’t have a boolean value for this? I only see fields like a date the customer was put on credit hold and a date they were taken off. I assume a credit hold is on if the date put on is valid and after the date taken off (or if the date taken off is null).

These values are already shown on the Billing/Credit tab.
Also the color is based on the Status property, to the background color one.

Thanks Jonathan,

From looking at the fields on the Billing > Credit tab I can see that I appear to be using the correct EpiBinding. It’s not clear to me why it works with a checkbox but not the shape - we are looking for this to show up in bold red when on credit or aging hold but not display when the applicable hold is not active.

I’m not following what you mean about the color. I’ve set the background color to Red, but it seems to ignore that and always display visible+green, hold or not.

You should be able to find a few topics on this If you try searching for “StatusTypes.Warning”
Here is one (of many) related topics

Ok, so it sounds like you are saying that I need to write some script code in the customization to change the status type which in turn changes the color?

If I look in Sales Order Entry in the Summary tab, there are several shapes which seem to be linked directly (via an EpiBinding) to a database field. For instance, eshClosed is bound to OrderHed.OpenOrder. I don’t see any script code, so I guess there is something built in to do this.

What I don’t understand from the linked code you provided is the context of the code which sets the shape status. I need to shape to be the correct color and visibility when the record is first loaded, as well as when the underlying field changes. I know I can set up event handlers on fields on the screen, but it sounds like I would need an event handler for changes in the field in the database, which I don’t think is possible.

Here is a VERY quick example for the Customer Tracker.
Note that I used two shapes to account for loading multiple customers, where some are on credit hold and others are not. I know it is ugly but… I was just playing around with this. I would definitely do something “cleaner”, only one shape in a production version.

	
private void CustCreditHold()
	// **** Call from edvCustomer_EpiViewNotification
	//  **** where args.NotifyType == EpiTransaction.NotifyType.Initialize
	{
		// string sCreditHold = edvCustomer.dataView[edvCustomer.Row]["CreditHold"].ToString();
		// string sCustID =  edvCustomer.dataView[edvCustomer.Row]["CustID"].ToString();
		// MessageBox.Show("CustID: " + sCustID + " CreditHold = " + sCreditHold);
		
            if (Convert.ToBoolean(edvCustomer.dataView[edvCustomer.Row]["CreditHold"].ToString())  == true)
			{
				shpCreditHold.Status = StatusTypes.Stop;
				// shpCreditHold.Status = StatusTypes.Warning;
				// shpCreditHold.Status = StatusTypes.OK;	
				// shpCreditHold.Status = StatusTypes.Global;
				shpCreditHold.EnabledCaption = "Credit Hold";
				// shpCreditHold.DisabledCaption = "Credit";
				shpCreditHold.Enabled = true;
				chkCustCredHold.Visible = true;
				shpCreditHold.Visible = true;
				shpCustCredHold02.Visible = false;
			}
			else
			{
				// shpCreditHold.Status = StatusTypes.OK;
				// shpCreditHold.Status = StatusTypes.Warning;
				// shpCreditHold.Status = StatusTypes.Stop;	
				// shpCreditHold.Status = StatusTypes.Global;
				shpCreditHold.EnabledCaption = "";
				// shpCreditHold.DisabledCaption = "Credit";
				shpCreditHold.Enabled = false;
				shpCreditHold.Visible = false;
				shpCustCredHold02.Visible = true;
				chkCustCredHold.Visible = false;
			}
	}

image

I usually use the Epicor Row Rules Engine… Add a fake EpiBinding to the shape ex OrderHed.eshMyShape and then you can use Row Rules what not.

private void CreateRowRuleOrderRelFirmReleaseCustomCondition_false()
{
	// Description: UnfirmedReleases
	// **** begin autogenerated code ****
	RuleAction invisibleOrderHed_eshUnfirmedReleases = RuleAction.AddControlSettings(this.oTrans, "OrderHed.eshUnfirmedReleases", SettingStyle.Invisible);
	RuleAction[] ruleActions = new RuleAction[] {
			invisibleOrderHed_eshUnfirmedReleases};
	// Create RowRule and add to the EpiDataView.
	RowRule rrCreateRowRuleOrderRelFirmReleaseCustomCondition_false = new RowRule("OrderRel.FirmRelease", new RowRuleConditionDelegate2(this.OrderRelFirmReleasefalse_CustomRuleCondition), null, ruleActions);
	((EpiDataView)(this.oTrans.EpiDataViews["OrderHed"])).AddRowRule(rrCreateRowRuleOrderRelFirmReleaseCustomCondition_false);
	// **** end autogenerated code ****
}

private bool OrderRelFirmReleasefalse_CustomRuleCondition(Ice.Lib.ExtendedProps.RowRuleDelegateArgs args)
{
	EpiDataView edvOrderRel = this.oTrans.Factory("OrderRel");

	if (edvOrderRel.Row != -1 && edvOrderRel.dataView.Count > 0) {
		return !Convert.ToBoolean(edvOrderRel.dataView.Table.Select("FirmRelease = 0 AND OpenRelease = 1").Length > 0);
	}

	return false;
}
2 Likes