Topic: How to clear "current credit" in the direct invoice screen?

In the direct invoice screen for a certain debtor a negative "current credit appears", but there are no outstanding payments. How can I reset this amount to zero?

thnx

Re: How to clear "current credit" in the direct invoice screen?

Remember that the credit limit is  not included in the information.

You can look at the function for duing this calculation in file /sales/includes/db/sales_order_db.inc, function
function get_customer_to_order($customer_id)
This is about line 457.

/Joe

3 (edited by apmuthu 01/08/2013 02:45:34 pm)

Re: How to clear "current credit" in the direct invoice screen?

Lines 457-458 of sales/includes/db/sales_order_db.inc:

cust.credit_limit - Sum(IFNULL(IF(trans.type=11 OR trans.type=12 OR trans.type=2,
-1, 1) * (ov_amount + ov_gst + ov_freight + ov_freight_tax + ov_discount),0)) as cur_credit

The ov_discount field is being added - is that right - should it not be subtracted?

Re: How to clear "current credit" in the direct invoice screen?

@apmuthu

I am not in office at present. Please make a test on the training Co. Make a direct invoice on a customer with some discount percent.

Also try a payment with a discount. Look into the table 0_debtor_trans and see if it is negative or positive. I cannot recall right now.

Joe

Re: How to clear "current credit" in the direct invoice screen?

@apmuthu

Yes it is correct. The ov_discount should be added in these cases. When the customer payments are done, they should include the ov_discount.

/Joe

Re: How to clear "current credit" in the direct invoice screen?

If so, is the ov_discount being stored as a negative value in the table? In related vein, will the discount percentages be stored in the negative as well while being entered positive in the form?

Re: How to clear "current credit" in the direct invoice screen?

No, it is stored as positive.

Example customer payment:

Customer pays 100. Discount is 10.
debtor_trans table.
ov_amount   100
ov_discount  10

Gl posting:
Bank debit      100
AR.    Credit.        110
Discount debit   10

Joe