on 08-11-2015 11:20 AM
HI Experts,
Fms query required as per the below requirement .
1)When Invoice is prepared from SO then Document date & Delivery date of Invoice must be same as SO
2)When Invoice is prepared from Delivery then Document date & Delivery date of Invoice must be same as Delivery
Regards,
K.Ramasamy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try this with
DECLARE @d1 AS DATETIME
DECLARE @d2 AS DATETIME
set @d1 = (SELECT T0.taxDate FROM odln T0 WHERE T0.DocEntry = $[$38.45.number] And $[$38.43.0]=15)
SET @d2 = (SELECT T0.taxDate FROM ORDR T0 WHERE T0.DocEntry = $[$38.45.number] And $[$38.43.0]=17 )
SELECT CASE WHEN $[$38.43.0]=17 THEN @d1 ELSE @d2 end
Hi Ramasamy,
I have checked in my DB, its working fine and as per your error message in my query i have not used this string $38.1.0.
Check this query
declare @sdocdate date
declare @ddocdate date
set @sdocdate= (select r.DocDate from ordr r where r.docentry=$[$38.45.number])
set @ddocdate= (select r.DocDate from ODLN r where r.docentry=$[$38.45.number])
select case when $[$38.43.number]=17 then @sdocdate else @ddocdate end
HELLO KENNEDY SIR ,
i have applied UNION but , every time an A/R invoice is created that will be based on either SALES ORDER or DELIVERY , So according to my query both the function ( upper and lower part of union ) will never be called at the same time (one part will always not satisfy) . only one will be valid and not the other .. so my query will get only ONE date that will be based on either SALES ORDER or DELIVERY. means whatever be the basetype of the A/R invoice.
Hi Ramasamy,
Open AR Invoice Menu and use copy from button to select Sales Order/Delivery and set the FMS query in AR invoice DocDate field and in auto refersh field field keep doctotal field as mentioned in Screen shot.
Note: This will work only when you use copy from button for selecting sale order and delivery.
Hii
apply auto refresh on any header level udf which is common in both SALES ORDER and DELIVERY and then you copy that UDF to your A/R Invoice .
Thanks
Ranu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ramasamy,
Try this query for both sale order and delivery's document date
declare @sdocdate date
declare @ddocdate date
set @sdocdate= (select r.DocDate from ordr r where r.docentry=$[$38.45.number])
set @ddocdate= (select r.DocDate from ODLN r where r.docentry=$[$38.45.number])
select case when $[$38.43.number]=17 then @sdocdate else @ddocdate end
Regards,
Bharathiraja
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi
try this one
SELECT T0.[DocDate] FROM ORDR T0 , RDR1 T1 WHERE T0.DocEntry = T1.DocEntry AND T1.[BaseRef] =$[ODLN.DocNum]
SELECT T0.[DocDate] FROM ODLN T0 , DLN1 T1 WHERE T0.DocEntry = T1.DocEntry AND T1.[BaseRef] =$[OINV.DocNum]
and update the Status
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi try this one
SELECT T0.[DocNum],T0.[DocDate],T0.[TaxDate],T0.[CardCode], T0.[CardName], T1.[Dscription], T1.[FreeTxt],T1.[Quantity], T1.[Price], T0.[DocStatus] FROM ODLN T0 INNER JOIN DLN1 T1 ON T0.DocEntry = T1.DocEntry WHERE T1.[BaseType] = 15 and T1.[BaseRef] =[%0] and T0.[DocDate] >='01/04/2010'
User | Count |
---|---|
110 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.