FrontAccountingERP / FA

Official FrontAccounting mirror repository
95 stars 97 forks source link

Customer Balances report is not correct for Journal Entry data #46

Open aksikitaindonesia opened 3 years ago

aksikitaindonesia commented 3 years ago

Customer Balances report is not correct for Journal Entry data But its' correct for Aged Customer Analysis report.

The fix is in the /reporting/rep101.php file:

Line 37-41:

     $sql = "SELECT SUM(IF(t.type = ".ST_SALESINVOICE." OR t.type = ".ST_JOURNAL.",
        abs(t.ov_amount + t.ov_gst + t.ov_freight + t.ov_freight_tax + t.ov_discount), 0)) AS charges,";
     $sql .= "SUM(IF(t.type != ".ST_SALESINVOICE." AND t.type != ".ST_JOURNAL.",
        abs(t.ov_amount + t.ov_gst + t.ov_freight + t.ov_freight_tax + t.ov_discount), 0)) AS credits,";
     $sql .= "SUM(IF(t.type != ".ST_SALESINVOICE." AND t.type != ".ST_JOURNAL.", t.alloc, -t.alloc)) AS Allocated,";

Line 75: abs(trans.ov_amount + trans.ov_gst + trans.ov_freight + trans.ov_freight_tax + trans.ov_discount) AS TotalAmount,

Line 231: if ($trans['type'] == ST_SALESINVOICE || $trans['type'] == ST_BANKPAYMENT || $trans['type'] == ST_JOURNAL)