كيف يمكن حصر الحركات التي تمت علي حسابات ذمم غير المذكورة في العملاء؟

Viewed 0

كيف يمكن حصر الحركات التي تمت علي حسابات ذمم غير المذكورة في العملاء

حيث قام العميل بتغيير الحسابات في العميل بعد استعمالها في قيود


Originally posted at https://answers.namasoft.com/question/617/ on 2019-01-06.

1 Answers

يمكن استخدام الاستعلام التالي على قاعدة البيانات لحصر الحركات المرحّلة على حسابات غير المحددة كحسابات ذمم للعميل (الحساب الرئيسي أو أي من الحسابات الفرعية 1 إلى 20 في بطاقة العميل):

select distinct l.originType, l.originId, l.originCode
from customer c
inner join ledgertransline l on l.subsidiaryId = c.id
where l.account_id <> c.mainAccount_id
  and (c.account1_id is null or l.account_id <> c.account1_id)
  and (c.account2_id is null or l.account_id <> c.account2_id)
  and (c.account3_id is null or l.account_id <> c.account3_id)
  and (c.account4_id is null or l.account_id <> c.account4_id)
  and (c.account5_id is null or l.account_id <> c.account5_id)
  and (c.account6_id is null or l.account_id <> c.account6_id)
  and (c.account7_id is null or l.account_id <> c.account7_id)
  and (c.account8_id is null or l.account_id <> c.account8_id)
  and (c.account9_id is null or l.account_id <> c.account9_id)
  and (c.account10_id is null or l.account_id <> c.account10_id)
  and (c.account11_id is null or l.account_id <> c.account11_id)
  and (c.account12_id is null or l.account_id <> c.account12_id)
  and (c.account13_id is null or l.account_id <> c.account13_id)
  and (c.account14_id is null or l.account_id <> c.account14_id)
  and (c.account15_id is null or l.account_id <> c.account15_id)
  and (c.account16_id is null or l.account_id <> c.account16_id)
  and (c.account17_id is null or l.account_id <> c.account17_id)
  and (c.account18_id is null or l.account_id <> c.account18_id)
  and (c.account19_id is null or l.account_id <> c.account19_id)
  and (c.account20_id is null or l.account_id <> c.account20_id)
order by l.originType

هذا الاستعلام يعيد نوع المستند ورقمه وكوده (originType, originId, originCode) لكل حركة سُجلت على حساب ذمم لا يطابق أيًا من حسابات العميل الحالية (الحساب الرئيسي وحسابات الذمم الفرعية من 1 إلى 20)، وهي الحالة التي تحدث عندما يتم تغيير حسابات العميل بعد أن استُخدمت الحسابات القديمة بالفعل في قيود سابقة.


Originally posted at https://answers.namasoft.com/question/617/ on 2019-01-06.