Query for purchase
Hi All,
I am unable to use this query as the data is repeating.
SELECT T1.CARDCODE, T1.CARDNAME , T1.DOCNUM as 'PURCHASE ORDER#',T1.DocStatus 'PO Status', T1.DOCDATE 'PO Date', T1.DocTotal 'PO Total', T0.[Dscription], T0.[Quantity],T0.[OpenQty],T1.[U_RevNo], T1.[U_RevDt], T1.[U_RevRmrks],T1.[Comments], T3.DOCNUM DRN#,T3.DocStatus 'DRN Status', T3.DOCDATE 'DRN Date',T2.[Dscription], T2.[Quantity],T2.[U_ExcsqTY] as 'Short/Excess', T3.DocTotal 'DRN Total',T3.[Comments],T5.DOCNUM Invoice#,T5.DocStatus 'Invoice Status', T5.DOCDATE 'Invoice Date',T4.[Dscription], T4.[Quantity], (T5.DocTotal-T5.VatSum-T5.TotalExpns-T5.DiscSum) 'Total Before Discount', T5.VatSum 'Tax', T5.TotalExpns 'Freight', (T5.DocTotal - T5.PaidToDate) 'Total Payment Due',T5.[Comments], T7.DOCNUM AS 'CREDIT MEMO#', T7.DOCDATE, T7.DOCTOTAL,T6.[Dscription], T6.[Quantity],T7.[Comments]
FROM DBO.POR1 T0
INNER JOIN DBO.OPOR T1 ON T1.DOCENTRY = T0.DOCENTRY
LEFT JOIN DBO.PDN1 T2 ON T2.BASEENTRY = T1.DOCENTRY
LEFT JOIN DBO.OPDN T3 ON T2.DOCENTRY = T3.DOCENTRY
LEFT JOIN DBO.PCH1 T4 ON T4.BASEENTRY = T1.DOCENTRY
LEFT JOIN DBO.OPCH T5 ON T5.DOCENTRY = T4.DOCENTRY
LEFT JOIN DBO.RPC1 T6 ON T6.BASEENTRY = T5.DOCENTRY
LEFT JOIN DBO.ORPC T7 ON T7.DOCENTRY = T6.DOCENTRY
where T1.DOCDATE >='[%0]' and T1.DOCDATE <='[%1]'
I tried to use distinct in the query but it shows error ,'The ntext type data cannot be selected as DISTINCT because it is not comparable.'
Thanks,
Joseph
Hi Joseph,
Try this:
SELECT T1.CARDCODE, T1.CARDNAME , T1.DOCNUM as 'PURCHASE ORDER#',T1.DocStatus 'PO Status', T1.DOCDATE 'PO Date', T1.DocTotal 'PO Total', T0.Dscription, T0.Quantity,T0.OpenQty,T1.Comments, T3.DOCNUM DRN#,T3.DocStatus 'DRN Status', T3.DOCDATE 'DRN Date',T2.Dscription, T2.Quantity, T3.DocTotal 'DRN Total',T3.Comments,T5.DOCNUM Invoice#,T5.DocStatus 'Invoice Status', T5.DOCDATE 'Invoice Date',T4.Dscription, T4.Quantity, (T5.DocTotal-T5.VatSum-T5.TotalExpns-T5.DiscSum) 'Total Before Discount', T5.VatSum 'Tax', T5.TotalExpns 'Freight', (T5.DocTotal - T5.PaidToDate) 'Total Payment Due',T5.Comments, T7.DOCNUM AS 'CREDIT MEMO#', T7.DOCDATE, T7.DOCTOTAL,T6.Dscription, T6.Quantity,T7.Comments
FROM DBO.POR1 T0
INNER JOIN DBO.OPOR T1 ON T1.DOCENTRY = T0.DOCENTRY
LEFT JOIN DBO.PDN1 T2 ON T2.BASEENTRY = T1.DOCENTRY AND T2.BaseLine=T0.LineNum
LEFT JOIN DBO.OPDN T3 ON T2.DOCENTRY = T3.DOCENTRY
LEFT JOIN DBO.PCH1 T4 ON T4.BASEENTRY = T1.DOCENTRY AND T4.BaseLine=T2.LineNum
LEFT JOIN DBO.OPCH T5 ON T5.DOCENTRY = T4.DOCENTRY
LEFT JOIN DBO.RPC1 T6 ON T6.BASEENTRY = T5.DOCENTRY AND T6.BaseLine=T4.LineNum
LEFT JOIN DBO.ORPC T7 ON T7.DOCENTRY = T6.DOCENTRY
where T1.DOCDATE >='[%0\]' and T1.DOCDATE <='[%1\]'
Thanks,
Gordon
Similar Messages
-
Customized Query for purchase register
Hi All,
I need a query for purchase register which gives excise information with biferication.
OPCH, PCH1, ORPC, RPC1 and IEI4
In excel reporter we get the purchase register report But excise amount does not come in that report.
So, I need Customised report for that.
Regards
Shashihi shashi,
SELECT M.DocNum AS 'AP Inv. #', M.DocDate as 'Date', M.CardName as 'Vendor Name',M.NumAtCard as 'Bill No. & Dt.',
(Select Sum(LineTotal) FROM PCH1 L Where L.DocEntry=M.DocEntry) as 'Base Amt.(Rs.)',
(SELECT Sum(TaxSum) FROM PCH4 where statype=-90 and DocEntry=M.DocEntry) as 'ED (Rs.)',
(SELECT Sum(TaxSum) FROM PCH4 where statype=-60 and DocEntry=M.DocEntry) as 'EDCS (Rs.)',
(SELECT Sum(TaxSum) FROM PCH4 where statype=7 and DocEntry=M.DocEntry) as 'HECS (Rs.)',
(SELECT Sum(TaxSum) FROM PCH4 where statype=1 and DocEntry=M.DocEntry) as ' VAT (Rs.) ',
(SELECT Sum(TaxSum) FROM PCH4 where statype=4 and DocEntry=M.DocEntry) as ' CST (Rs.) ',
(SELECT Sum(TaxSum) FROM PCH4 where statype=10 and DocEntry=M.DocEntry) as ' CVD (Rs.) ',
(SELECT Sum(TaxSum) FROM PCH4 where statype=5 and DocEntry=M.DocEntry) as ' Ser.Tax (Rs.) ',
(SELECT Sum(TaxSum) FROM PCH4 where statype=6 and DocEntry=M.DocEntry) as 'CS on Ser.Tax (Rs.)',
(SELECT Sum(TaxSum) FROM PCH4 where statype=8 and DocEntry=M.DocEntry) as 'HECS_ST (Rs.)',
(Select Sum(LineTotal) From PCH3 Q Where Q.DocEntry=M.DocEntry) AS 'Freight (Rs.)',
M.WTSum AS 'TDS (Rs.)',
M.DocTotal as 'Total (Rs.)'
FROM OPCH M LEFT OUTER JOIN PCH1 L on L.DocEntry=M.DocEntry
LEFT OUTER JOIN PCH4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum
LEFT OUTER JOIN PCH5 J ON M.DocEntry = J.AbsEntry
LEFT OUTER JOIN PCH3 Q ON M.DocEntry = Q.DocEntry
WHERE (M.DocDate >= '[%0]' AND M.DocDate <= '[%1]') AND (T.TrgetEntry = ' ')
GROUP BY
M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.[DiscSum],M.WTSum,M.DocTotal
ORDER BY
M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.[DiscSum],M.WTSum,M.DocTotal
Jeyakanthan -
Query For Purchase A/P Cycle Details
Hi
All export pls. provide me Query for Purchase A/P Cycle Details i.e Vendor Code Vendor Description doc. date posting date po date amount quantity unit price same as Grpo returns and invoice in singal screen
Thanks & RegardsHi,
What do you mean by Query for Purchase A/P Cycle . All Query for A/P Cycle , you can search in SDN.Any specific unsolved query for you can be posted here.Ok.
Check the details:
1.PO creation
http://e-mory.blogspot.com/2008/01/sap-me21n-create-purchase-order_30.html
2.Goods Receipt
http://e-mory.blogspot.com/2008/02/sap-migo-goods-receipt.html
3.Invoice Verification
http://e-mory.blogspot.com/2007/11/sap-miro-enter-invoice-verification.html
Regards,
Biju K -
Hi,
I want to FMS Query for Purchase Order.
I want to display the weight * price in one user define field.
Please suggest meHi Tushar.......
Try this.......
declare @var1_wt as varchar(255)
declare @var2_Pr as varchar(255)
declare @var3 as float
declare @var4 as float
set @var1_wt=$[$38.58.0]
set @var2_Pr=$[$38.14.0]
set @var3=cast( substring(replace(@var1_wt,',',''),0,len(replace(@var1_wt,',',''))-1) as float)
set @var4=cast(substring(replace(@var2_Pr,',',''),0,len(replace(@var2_Pr,',',''))-3) as float)
select @var3 * @var4
Regards,
Rahul -
Creating a Query for Purchase Order Approval
I need to develop a query to check if any of the line totals in a new purchase order exceeds $500. I have to attach this query to the approval procedure (under 'Terms' in 'Define Approval templates'). When the 'Add' button on the purchase order is clicked, the values on the form are still not available in the database. This means, my query has to pick the data from the new purchase order form. Is there any way to build such a query? Thanks.
Satish, Alerts just notify the appropriate parties. They do not stop a document from being posted. This means, it is not capable to recognize the situation unless it's already stored in the DB.
Alexey. what about creating a Development Request about this topic?
Regards,
Felipe -
Could someone share with me a Query for Purchase report in BP Currency?
Hi All,
Does anyone have a Purchase Analysis query by Business Partner (Vendor/Supplier) that returns all invoices by the month or anything else (items etc purchased) by the month in BP Currency please?
I would like to use it as standalone query and eventually import it as a Crystal Report query.
Appreciate it. Thank you.I just managed to create the report using Crystal and db files coming from Purchase Invoice and currency details coming from BP vendor file.
-
Hello
I am doing a Query. I need to add this field with the complete name of the person who did a Purchase document order.
I found this field with this information througt transacction SU01.
Full Name of Person
ADDR3_DATA
NAME_TEXT
That field contains the information that I need. But the problem is, this table in not allowed to be used as a join table.
I have been looking with the tables conected to this field but they do not load the data that I need.
If someone know something about it,Irma, como estás?
Probá con la tabla USER_ADDR o la USR03.
Saludos -
Query for purchasing accrual in 12i
Hi
We have migrated to 12i ,the references in gl_import_references are no more updated after 12 i upgrade.
Please find the 11i query,we need to change it to 12i using xla tables.
SELECT
gl_ledgers.NAME AS book_name,
gl_periods.period_year AS fiscal_year,
DECODE (gl_periods.quarter_num,
1, '1st QTR',
2, '2nd QTR',
3, '3rd QTR',
4, '4th QTR'
) AS quarter,
gl_periods.period_num AS period_number,
gl_je_headers.period_name AS period_name,
gl_je_headers.je_source AS SOURCE,
gl_je_headers.je_category AS CATEGORY,
gl_code_combinations.segment1 AS company,
gl_code_combinations.segment2 AS cost_center,
gl_code_combinations.segment3 AS ACCOUNT,
gl_code_combinations.segment4 AS program,
gl_code_combinations.segment5 AS future,
po_distributions_all.expenditure_type AS expenditure_type,
po_distributions_all.expenditure_item_date AS expenditure_date,
gl_je_lines.accounted_dr, gl_je_lines.accounted_cr,
po_distributions_all.quantity_delivered AS pa_quantity, 'Accrual' TYPE,
DECODE (gl_code_combinations.segment2,
'0000', 'BS',
'PL'
) AS ledger_type,
ap_suppliers.vendor_name,
gl_je_lines.reference_4 AS po_number,
gl_je_lines.description
FROM gl.gl_je_headers,
gl.gl_je_lines,
gl.gl_ledgers,
gl.gl_code_combinations,
po.po_distributions_all,
po.po_headers_all,
gl.gl_periods,
ap.ap_suppliers
WHERE gl_je_headers.je_source = 'Cost Management' --Changed to Cost Management
AND gl_je_headers.je_header_id = gl_je_lines.je_header_id
AND gl_je_headers.ledger_id = gl_ledgers.ledger_id
AND gl_code_combinations.code_combination_id =
gl_je_lines.code_combination_id
AND gl_code_combinations.segment3 <> '23004'
AND po_distributions_all.po_header_id(+) =
TO_NUMBER (RTRIM (SUBSTR (gl_je_lines.reference_2, 1, 10)))
AND po_distributions_all.po_distribution_id =
TO_NUMBER (RTRIM (SUBSTR (gl_je_lines.reference_3, 1, 10)))
AND po_distributions_all.po_header_id = po_headers_all.po_header_id
AND po_headers_all.vendor_id = ap_suppliers.vendor_id
AND gl_je_headers.period_name = gl_periods.period_name
Can someone help usHello Mr.Raman,
Thanks for your response to my query.
As per my company requirement i have to track duplicate payment made to the vendor against same PO.
So for that after completing the cycle PR-PO-GR-IR-F-53 finally i found two records in BSAK table out of which :
One record was with my accounting document no from my invoice receipt of type RE.
Another record was with the vendor payment clearance document with type KZ.
Now again i have done payment to the vendor using F-53 tcode and now i found one more record with belnr = last payment document no and augbl = new payment document no. with type KZ.
So if i use below mentioned logic to track for duplicate payments made to the vendor ,then it will be fine or if not can you suggests me the needful changes in the logic.
1.) Check If record exists for my belnr no from invoice recipt in bsak.
2.) Take AUGBL No for this BELNR No and check if record exists for this AUGBL with type KZ.
Note:Means payment is done to the vendor upto this logic.
3.) Now if with the found record with type KZ any other record found with type KZ it can be taken of as duplicate payment made to the vendor.
Please suggest me if above mentioned logic is fine.
Regards.
Abhinav Goel. -
Hi Experts,
The user has requested to prepare current datewise report of all purchase order. Please guide me regarding this.Hi Shailesh.....
Try this.....
Select T0.DocNum, T0.CardName, T0.DocStatus, T1.Dscription, T1.Quantity, T1.Price, T1.LineTotal
from OPOR T0 Inner Join POR1 T1 On T0.DocEntry=T1.DocEntry
Where DateDiff (dd, T0.DocDate, GetDate())=0
Regards,
Rahul -
Query for Opening Stock + Purchase Qty + Sales Qty
Hi ,
Can anyboday help me by how to develop a query for the following requirement. If any custom query is available please provide me .We are working on SBO 2007B PL 8. The required report structure is
ItemNo ***OpeningStock**** Purchase ********* Sales****
(Batchwise)** Qty*** Value ****Qty** Value ***Qty***Value
Thanks & Regards
SriniHi Srini,
I found this on the forum, see if it helps you;
select b.Itemcode,b.Item_Description,b.UOM, b.rate as Rate,b.Opening_Stock,b.Receipt,b.Issue, b.Material_Revalue,b.Closing_Stock,b.Closing_Value from (select *,(case closing_stock when 0 then 0 else(Closing_Value/Closing_Stock)end) as Rate from( SELECT T0.Itemcode as 'Itemcode' ,min(T0.Dscription) as 'Item_Description', max(T1.InvntryUom) as UOM, (isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate<'[%0]' and O1.transtype in (58,59,20,16,67,-2)),0) - isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate<'[%0]' and O1.transtype in (58,21,19,60,15,67,-2,13)),0)+ (isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.transtype in (-2)),0) - isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.transtype in (-2)),0)))as Opening_Stock, (isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.inqty>0 and O1.transtype in (20,18)),0) + isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.inqty>0 and O1.transtype in (67)),0) + isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.inqty>0 and O1.transtype in (58,59,16,14)),0)) as Receipt, (isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.outqty>0 and O1.transtype in (13,15)),0) + isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.outqty>0 and O1.transtype in (67)),0)+ isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.outqty>0 and O1.transtype in (58,60,21,19)),0)) as Issue, isnull((select sum(Transvalue) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate<='[%1]' and O1.transtype in (162)),0) as Material_Revalue, (isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate<='[%1]' and O1.transtype in (58,59,20,16,14,19,67,-2)),0) - isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate<='[%1]' and O1.transtype in (58,21,19,60,15,67,-2,13)),0))as Closing_Stock, isnull((select sum(Transvalue) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate<='[%1]' and O1.transtype in (58,18,-2,67,59,20,16,14,15,13,21,19,60,69,162)),0) as Closing_Value FROM OINM T0 INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode INNER JOIN OITW T2 ON T1.ItemCode = T2.ItemCode INNER JOIN OITB B1 ON T1.ItmsGrpCod=B1.ItmsGrpCod where ((B1.ItmsGrpNam>='[%2]' and B1.ItmsGrpNam<='[%3]') or ('[%2]'='' and '[%3]'='')) GROUP BY T1.itemcode,T0.Itemcode )a Where (a.Opening_Stock + a.Receipt + a.Issue + a.Material_Revalue + a.Closing_Stock + a.Closing_Value) <> 0 )b
Thanks,
Joseph -
ESOA: Enterprise Service for Purchase Requisition Query.
Hi,
I am not sure whether I am posting this question to the right forum, if not then please let me know the correct route.
I am trying to test the standard enterprise service for purchase requisition query response. It brings all the purchase requisitions even though they are deleted and not appearing in MD04.
Is there a way I can restrict and get only active purchase requistion. I am using the service PurchaseRequestItemByProductAndOrganisationalDataQueryResponse_InNot Answered.
-
Windows Intune Purchase Query for Microsoft Silver Competency Partner India
Hi Support
We are having a query regarding purchasing of Windows Intune. We are Microsoft Silver Competency Partner with
Partner ID: #####.
We just want to know that is there any discount available for Microsoft Silver Competency Partner on purchasing of Windows Intune?
Please send us the discount information ASAP.Ashish. You shouldn't publish your partner details on a public forum like this - I'd advise you to remove it. This is a question for your Microsoft Licensing Reseller.
Gerry Hampson | Blog:
www.gerryhampsoncm.blogspot.ie | LinkedIn:
Gerry Hampson | Twitter:
@gerryhampson -
Query for Monthwise & Statewise Purchase
Hi Experts
I need query for monthwise & statewise purchase
Purchase - A/P Credit Memo like in matrix
BR
Manish PandeyHi Manish Pandey
Welcome To SAP Community Network Forum
Try This
SELECT P.[STATE],
[1] as [Jan],
[2] as [Feb],
[3] as [Mar],
[4] as [Apr],
[5] as [May],
[6] as [Jun],
[7] as [Jul],
[8] as [Aug],
[9] as [Sep],
[10] as [Oct],
[11] as [Nov],
[12] as [Dec]
FROM (SELECT Left(T0.CardCode,2) as [State],
T0.DocTotal as [DocTotal],
MONTH(T0.docdate) as [month]
FROM dbo.OPCH T0
WHERE Year(T0.docdate)=2011
UNION
SELECT Left(T0.CardCode,2) as [State],
-T0.DocTotal as [DocTotal],
MONTH(T0.docdate) as [month]
FROM dbo.ORPC T0
WHERE Year(T0.docdate)=2011 ) S
PIVOT (SUM(DocTotal) FOR [month] IN
([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12])) P
ORDER BY P.[State]
Thanks,
Srujal Patel -
Query For Finding Revised PO Amout in Purchasing in Each Revisions
Can anybody please tell me how
can i write a query for Extracting
individual PO amounts in each revisions of a
PO from PO_LINES_ARCHIEVE_ALL..
ie FOR Each revisions of a PO What was the total PO Amount
Regards
BinuHi Geoff,
You can use the ROW_NUMBER and CASE Functions to acheive this. Here with , i have give u a small idea with an ex:
Qry :
B.ItemCode,SUM(B.PO1)[PO1],SUM(B.POQty1)[POQty1],SUM(B.PO2)[PO2],SUM(B.POQty2)[POQty2] From
select Itemcode
CASE when Sno=1 Then DocNum End [PO1]
CASE When Sno=1 Then Qty End [POQty1]
CASE when Sno=2 Then DocNum End [PO2]
CASE When Sno=2 Then Qty End [POQty2]
From(
Row_Number() Over (Order By Opor.Docnum) [Sno], Opor.DocNum,POr1.ItemCode,sum(POr1.Quantity)[Qty] from OPOR join Por1 on Opor.DocEntry=por1.DocEntry
ItemCode='20002' group by oPor.DocNum,por1.ItemCode
A where A.Sno<=2)B Group By B.ItemCode
Result :-
ItemCode PO1 POQty1 PO2 POQty2
20002 18 1.000000 19 10.000000
Thanks,
Karthikeyan.P -
Re:Query for Stock Statement for a particular item..!!!!
Dear SAP Experts,
I need a stock statement query for a particular item which contains:
1.ItemCode
2.Item Description
3.Item Price
4.Opening
5.Receipts
6.Issues
7.Closing
8. Value
The selection criteria are:
1.Warehouse code
2.Item Name
3.Posting Date
Plz give me a good solution for this issue.
With Regards,
RevathyCheck this
Declare @FromDate Datetime
Declare @ToDate Datetime
set @FromDate =
(Select min(S0.Docdate) from OINM S0 where S0.Docdate >='[%0]')
set @ToDate =
(Select max(S1.Docdate) from OINM S1 where S1.Docdate <='[%1]')
select * from
SELECT T0.itemcode,
min(T0.Dscription) as 'Item Description',
min(B1.ItmsGrpNam) as 'Item Group', W1.Whscode, C1.Location,
(isnull((
Select sum(isnull(inqty,0))
from OINM O1
where O1.itemcode=T1.itemcode
and O1.Warehouse=W1.Whscode
and O1.docdate<@FromDate ),0)-
isnull((
Select sum(isnull(outqty,0))
from OINM O1
where O1.itemcode=T1.itemcode
and O1.Warehouse=W1.Whscode
and O1.docdate<@FromDate),0)
) as [Opening Stock],
isnull((
Select sum(isnull(inqty,0))
from OINM O1
where O1.itemcode=T1.itemcode
and O1.Warehouse=W1.Whscode
and O1.docdate>=@FromDate
and O1.docdate<=@ToDate and O1.inqty>0
and O1.transtype in (20,18)),0
) as [Purchase Quantity],
isnull((
Select sum(isnull(outqty,0))
from OINM O1
where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode
and O1.docdate>=@FromDate and O1.docdate<=@ToDate
and O1.outqty>0 and O1.transtype in (21,19)),0
) as [Purchase Return Quantity],
isnull((
Select sum(isnull(outqty,0))
from OINM O1
where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode
and O1.docdate>=@FromDate and O1.docdate<=@ToDate and O1.outqty>0
and O1.transtype in (13,15)),0
) as [sale Quatity],
(isnull
Select sum(isnull(inqty,0))
from OINM O1
where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode
and O1.docdate<=@ToDate),0
isnull((
Select sum(isnull(outqty,0))
from OINM O1
where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode
and O1.docdate<=@ToDate),0)
) as [Closing Stock]
FROM OINM T0
INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode
INNER JOIN OITW T2 ON T1.ItemCode = T2.ItemCode
INNER JOIN OITB B1 ON T1.ItmsGrpCod=B1.ItmsGrpCod
INNER JOIN OWHS W1 ON T2.WhsCode = W1.WhsCode
INNER JOIN OLCT C1 ON W1.Location=C1.Code
Group by T1.itemcode, T0.Itemcode, W1.WhsCode, C1.Location
) a
where (a.[Opening Stock]
+a.[Purchase Quantity]
+ a.[Purchase Return Quantity]
+a.[sale Quatity]+a.[Closing Stock]
) !=0
Regards,
Bala
Maybe you are looking for
-
Firewire drives freezing intermitantly
When I upgraded to my current G5 in 2004 I took the old drives out of my G3 and stuck them in cheap firewire cases, these never worked well but I assumed that the problem was the cheap cases. This winter I finally got around to buying a nice dual cas
-
For some reason, there are no options to import certain things, when I click import from iPhoto it just starts importing them all! I'm using iPhoto 11 and elements 12
-
Notes missing after mountain lion upgrade
Just upgraded to Mountain Lion. I had a number of notes made in the old Mail applicaiton - some of these seem to have been moved over to the new Notes application, but many seem to be lost in the ether somewhere - I can find them if I know what is i
-
Having trouble with my email from google
Having trouble with my email from gmail, both on my iPhone and on my iMac. It keeps asking to validate my password and e en after that it won't work. Does anyone know what to do?
-
My trial version expired so I signed up for a subscription, downloaded acrobatas instructed but now when I open acrobat here is what I get: