Topic: Missing store data for Salesman on debtor_trans table
Let says we have 2 salesman : Salesman1 and Salesman2
And we have a customer named MoneyMaker ltd with it's branch MoneyMaker which has assigned for Salesman1
By 1st Sep 2018 we created an invoice #1 for MoneyMake with it's value $300.
By 4th Sep 2018 we reassigned MoneyMaker for Salesman2 then created invoice #2 for same customer with value $200.
Now, print report for Salesman Listing (rep_106) we will see Grand Total of Salesman1 is zero, and Salesman2 is $500.
This seems wrong since Salesman1 has $300 revenue and Salseman2 has $200.
This problem happened because in debtor_trans table we only refer to branch_code without store saleman_code for transactions.
Will need to add column salesman_code for debtor_trans table and modify function write_customer_trans() as well. Also change SELECT query in rep_106 and may somewhere else.