V175 Job Cost Lines Linked to GRN  Topic is solved

Discussions relating to Jiwa 7 plugin development, and the Jiwa 7 API.

V175 Job Cost Lines Linked to GRN

Postby 2can2 » Thu May 13, 2021 4:33 pm

Hi, I have an issue where a client is processing GRN's to Jobs using the SAME PartNo for multiple lines, each line being for a different Job. I am trying to get the link to work between RE_Lines and JB_CostEntryLines using the PackSlipID and InventoryID to join which works fine if different Partno's are used for each line! However in this scenario there are 9 RE Lines (same PartNo) and my query below returns 81 lines!! 9 x9.
has anyone ideas to correct this, I can't see any other distinguishing field that can ne used to qualify?

Cheers



Code: Select all
SELECT RE_Lines.LineNumber, JB_CostEntryLines.Qty, JB_CostEntryLines.UnitCost, RE_Lines.SuppliersCost, JB_CostEntryLines.ComponentNo, JB_CostEntryLines.ComponentDesc, RE_Lines.Description, RE_Main.SlipNo,
JB_Main.JobNo
FROM RE_Main INNER JOIN
RE_Lines ON RE_Main.PackSlipID = RE_Lines.PackSlipID FULL OUTER JOIN
JB_CostEntryLines INNER JOIN
JB_Main ON JB_CostEntryLines.JobID = JB_Main.JobID ON RE_Lines.InventoryID = JB_CostEntryLines.ComponentID AND RE_Lines.PackSlipID = JB_CostEntryLines.LinkID
WHERE (RE_Main.SlipNo = '275250/INV-0772')
ORDER BY RE_Lines.LineNumber
2can2
Frequent Contributor
Frequent Contributor
 
Posts: 171
Joined: Tue Feb 26, 2008 10:24 am
Topics Solved: 25

Re: V175 Job Cost Lines Linked to GRN

Postby Scott.Pearce » Fri May 14, 2021 4:27 pm

I use this query for the link between a GRN line (RE_Lines) and a Job Costing job (JB_Main):

Code: Select all
SELECT RE_Main.SlipNo, RE_Lines.LineNumber, RE_Lines.PartNo, RE_Lines.Description, RE_Lines.JobCharge, JB_Main.JobNo, JB_CostCentres.CostCentreNo, JB_Stages.StageNo
FROM RE_Main
JOIN RE_Lines ON RE_Main.PackSlipID = RE_Lines.PackSlipID
JOIN JB_JobStages ON RE_Lines.JB_JobStages_RecID = JB_JobStages.RecID
JOIN JB_Stages ON JB_JobStages.JB_Stages_RecID = JB_Stages.RecID
JOIN JB_JobCostCentres ON JB_JobStages.JB_JobCostCentres_RecID = JB_JobCostCentres.RecID
JOIN JB_CostCentres ON JB_JobCostCentres.JB_CostCentres_RecID = JB_CostCentres.RecID
JOIN JB_Main ON JB_JobCostCentres.JobID = JB_Main.JobID


Does this help?
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 765
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 230

Re: V175 Job Cost Lines Linked to GRN

Postby 2can2 » Sat May 15, 2021 6:16 pm

Hi Scott,
Thanks for the reply. Unfortunately it doesn't really help as I need the link between RE_Lines and JB_CostEntryLines (even if Null). The issue is if RE_Lines uses the same partno for multiple lines then my links duplicate the same PartNo lines that many times? I can't seem to link a one to one relationship?
2can2
Frequent Contributor
Frequent Contributor
 
Posts: 171
Joined: Tue Feb 26, 2008 10:24 am
Topics Solved: 25

Re: V175 Job Cost Lines Linked to GRN  Topic is solved

Postby Scott.Pearce » Mon May 17, 2021 10:16 am

I'm with you now. The Job Costing data structures are far from ideal. But here's what you need:

Code: Select all
SELECT RE_Lines.LineNumber, JB_CostEntryLines.Qty, JB_CostEntryLines.UnitCost, RE_Lines.SuppliersCost, JB_CostEntryLines.ComponentNo, JB_CostEntryLines.ComponentDesc, RE_Lines.Description, RE_Main.SlipNo, JB_Main.JobNo
FROM RE_Main
JOIN JB_CostEntryLines ON RE_Main.PackSlipID = JB_CostEntryLines.LinkID
JOIN JB_Main ON JB_CostEntryLines.JobID = JB_Main.JobID
JOIN RE_Lines ON (RE_Main.PackSlipID = RE_Lines.PackSlipID AND JB_CostEntryLines.ComponentID = RE_Lines.InventoryID AND RE_Lines.JB_JobStages_RecID IN (SELECT StageID FROM JB_JobStages WHERE CostCentreID IN (SELECT CostCentreID FROM JB_JobCostCentres WHERE JobID = JB_Main.JobID)))
WHERE RE_Main.SlipNo = '275250/INV-0772'
ORDER BY RE_Lines.LineNumber


The above assumes that there is NOT multiple receival lines that have the SAME part no AND are both for the SAME job.
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 765
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 230

Re: V175 Job Cost Lines Linked to GRN

Postby 2can2 » Mon May 17, 2021 10:36 am

Awesome, thanks Scott!
2can2
Frequent Contributor
Frequent Contributor
 
Posts: 171
Joined: Tue Feb 26, 2008 10:24 am
Topics Solved: 25


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 5 guests