Hi guys i have dynamic nav 2009 and sql server 2005
I have this query show data from sales line and sales header
SELECT ROW_NUMBER() OVER (ORDER BY dbo.[Jeddah-Live$Sales Header].No_) AS [م], dbo.[Jeddah-Live$Sales Line].[Document No_] AS 'رقم الطلب',
dbo.[Jeddah-Live$Sales Header].[Bill-to Name] AS 'العميل', dbo.[Jeddah-Live$Sales Line].Area AS 'نوع الصبه', dbo.[Jeddah-Live$Sales Line].Description AS 'البيان',
dbo.[Jeddah-Live$Sales Header].[Pump No_] AS 'المضخه',dbo.[Jeddah-Live$Sales Line].[Outstanding Quantity]
FROM dbo.[Jeddah-Live$Sales Header] INNER JOIN
dbo.[Jeddah-Live$Sales Line] ON dbo.[Jeddah-Live$Sales Header].No_ = dbo.[Jeddah-Live$Sales Line].[Document No_] AND
dbo.[Jeddah-Live$Sales Header].[Sell-to Customer No_] = dbo.[Jeddah-Live$Sales Line].[Sell-to Customer No_]
WHERE DATE DIFF(d,dbo.[Jeddah-Live$Sales Line].[Shipment Date],GETDATE()) = 0
The query above success work and show data based on date today
My question :I need to add debit balance and credit balance to every customer
from starting period until today
How i do that
0
Comments
On your questions, I'd suggest looking at how NAV produced those numbers. Look to reports or pages where that information would normally be viewed in NAV. Then use the logic of that function to design your SQL queries. It will also give you something to test your queries against. For example, run a "Customer Trial Balance" or "Customer AR Aging". Do your SQL queries yield the same results.
if i need to make query
How i do
if it is wrong
show to me the true if possible
Can you help me in write view collect IN SQL SERVER 2005 TO GET
Sum of debit balance to every customer from (details customer ledger entry table)
AND
Sum of credit balance to every customer from (details customer ledger entry table)
AND
Customer No from (customer table)
AND
Customer Name from (customer table)
Relation between customer table and details customer ledger entry table
eg Debit Amount CalcFormula is:
Which would be (ignoring global dim 1, 2, Posting Date - since you want everything -, and currency code):
Change the HAVING line to "HAVING ([Entry Type] <> 2) AND ([Customer No_] = '<CustomerNo>')" if you want a specific customer, not just a full list.
To get both Debit and Credit just make the select statement read
SELECT SUM([Debit Amount]) AS SumDebitAmount, SUM([Credit Amount]) AS SumCreditAmount, [Customer No_]
And finally including the Customer Name: