---------------------------------------------------------------------------------
OnRun()
MESSAGE (FORMAT(GetCusBalOverXDays('30000',30)));
GetCusBalOverXDays(CusNo : Text;Days : Integer) : Decimal
CLE.SETCURRENTKEY("Customer No.");
CLE.SETRANGE("Customer No.",CusNo);
CLE.SETRANGE(Open,TRUE);
DayExp := '<-'+FORMAT(Days)+'D>';
OldDate := CALCDATE(DayExp,TODAY);
CLE.SETFILTER("Posting Date",'>='+FORMAT(OldDate));
CusAmt := 0;
IF CLE.FIND('-') THEN BEGIN
REPEAT
CLE.CALCFIELDS("Amount (LCY)");
CusAmt := CusAmt + CLE."Amount (LCY)";
UNTIL CLE.NEXT <= 0;
END;
EXIT (CusAmt);
-------------------------------------------------------------------------------------
Modify the C99008900 POS functions, Search for Customer."Credit Limit and include the balance from the previous function in the balance check.
-------------------------------------------------------------------------------------
IF (BillToCustomer."Credit Limit (LCY)" <> 0) THEN BEGIN
cBalanceOverLimit := (BillToCustomer."Balance (LCY)" + Customer."Amt. Charged On POS" +
BillToCustomer."Amt. Charged On POS" - Customer."Amt. Charged Posted" -
BillToCustomer."Amt. Charged Posted" + Payment) - BillToCustomer."Credit Limit (LCY)";
//MOD1
//IF cBalanceOverLimit > 0 THEN BEGIN
IF (cBalanceOverLimit > 0) AND (DT.GetCusBalOverXDays(BillToCustomer."No.",30)>0) THEN BEGIN
//MOD1
IF NOT MgrKey THEN BEGIN
MessageTxt := STRSUBSTNO(Text050,Customer."Bill-to Customer No.");
EXIT(FALSE);
END;
IF (BillToCustomer."Credit Limit (LCY)" <> 0) THEN BEGIN
cBalanceOverLimit := (BillToCustomer."Balance (LCY)" + Customer."Amt. Charged On POS" +
BillToCustomer."Amt. Charged On POS" - Customer."Amt. Charged Posted" -
BillToCustomer."Amt. Charged Posted" + Payment) - BillToCustomer."Credit Limit (LCY)";
//MOD1
//IF cBalanceOverLimit > 0 THEN BEGIN
IF (cBalanceOverLimit > 0) AND (DT.GetCusBalOverXDays(BillToCustomer."No.",30)>0) THEN BEGIN
//MOD1
IF NOT MgrKey THEN BEGIN
MessageTxt := STRSUBSTNO(Text050,Customer."Bill-to Customer No.");
EXIT(FALSE);
END;
No comments:
Post a Comment