1. FAQ- POSSIBLE REPORT QUERY

Manex has over 400 dynamic tables, so it would be very difficult for us to continually update/maintain these.  So we will not be providing any table listings and relationship information in a standard format.   What we have done and can continue to do is have users let us know which specific table they are looking for and what they are trying to create so we can give some information related to that area

 

As requests arise, we will create a cursor that captures some data from the related files. If users have any knowledge of queries, they should be able to add or subtract information they might need or not need from the basic outline. 

 

These queries are for your reference and are subject to change at anytime due to programming.
 

 

In addition the below suggestion might help you find specific Table/fields you desire in your report:

  • Using your TEST ManEx system.
  • Make the desired record entry within Manex
  • Save all of the records/changes
  • Completely Exit the TEST ManEx system
  • Close the TrigTimer
  • Then go to the TEST ManEx\DBFS directory
  • Change the View to “Details”
  • Then sort the tables per “Date Modified”
This will narrow your search down to at least a small hand full of tables, that the desired field could be located.
 
Note:  Once SQL conversion has been completed ManEx will be able to more easily provide Table/Structure changes to our users when their Custom reports are concerned.  At this point in time if one of their Custom reports stop working possibly due to Table/Structure changes made by ManEx, they will have to provide us with the SQL statement for review and assistance.   
1.1. BOM Query - Bill of Material Basic Table Query

 

lcBompnt = "_14C0LEUMM"  && make this any parent uniq key
 
SELECT I1.part_no as assyno, I1.descript as assydes, bom_det.item_no, I2.part_no as compno, I2.descript as compdes,;
 invtmfhd.Partmfgr,invtmfhd.mfgr_pt_no,;
 invtmfgr.whno,invtmfgr.qty_oh;

 FROM inventor as I1, inventor as I2, bom_det, invtmfhd, invtmfgr;
 WHERE I1.uniq_key = lcBompnt;
  AND I2.uniq_key = bom_det.uniq_key;
  AND bom_det.bomparent = lcBompnt;
  AND invtmfhd.uniq_key = I2.uniq_key;
  AND invtmfhd.uniqmfgrhd = invtmfgr.uniqmfgrhd;
 ORDER BY item_no, partmfgr;
 INTO CURSOR seeit
BROWSE LAST nowait
  
  
1.2. BOM Query - BOM relationship between Parent and Component PN

Question:

What table(s) do I find the relationship between a Parent Assembly P/N and its Component P/Ns?  Put another way, how can I determine which Parent Assembly P/N(s) a Component is used on?  What is the linking data element?

 

How can I see which Parent is driving the need for an MRP required quantity such as the information displayed on top portion of the MRP Demands and AVL screen?

 

 

 

Suggested Resolution:

Once you find the uniq_key of your subject component, search the BOM_DET table uniq_key for that same field. The BOMPARENT field associated with the Uniq_key will be the Uniq_key for the parent part.

 

Finding the AVL is a different matter. First, you have to check the parent part in the inventor table to see if a customer number is associated with it. This is in the BOMCUSTNO field. If there is, then check the avl of the consigned component for that customer. If it isn’t associated with a customer, then check the internal AVL for the component.

1.3. BOM Query - BOM, Manufacture and Anti Avl Query
This code was created to show how the data connection between BOM_DET, Inventor, Invtmfhd, and AntiAvl tables.

*This code is not an "end product", it was not tested nor it is optimized and might take substantial time to run on the large scale data.  The user may use this code for the reference. If they choose to use it as the "ready to use" code they should do so at their own risk.  
*-- IA = Inventor (for assembly)
*-- IC = Inventor (for internal components)
*-- I2 = Inventor (for consigned components)

*--enter your assy # and revision here
lcPart_no='910-1004                
'
lcRevision='A  
'

*-- This gathers the consigned part numbers and AVL for the BOM

SELECT Bom_det.Bomparent,Bom_det.uniq_key,Bom_det.qty,IA.BomCustno as AssemblyCust,;
 IA.part_no as AssemblyNo,IA.Revision as AssemblyRev,Bom_det.item_no,;
 IC.Part_sourc,IC.Part_no,IC.Revision ,I2.uniq_key as ConsgUniq, ;
 Invtmfhd.PartMfgr,Invtmfhd.Mfgr_pt_no
;
FROM Bom_det,Inventor IA, Inventor IC,Inventor I2 ,Invtmfhd;
WHERE Bom_det.Bomparent=IA.Uniq_key ;
 AND Bom_Det.Uniq_key=IC.Uniq_key ;
 AND Invtmfhd.Uniq_key=I2.uniq_key;
 AND IA.Part_no= lcPart_no;
 AND IA.Revision=lcrevision;
 AND I2.Custno=IA.BomCustNo;
 AND I2.Int_uniq=IC.Uniq_key;
 AND I2.Part_sourc='CONSG';
 AND BomParent+I2.uniq_key+Invtmfhd.PartMfgr+Invtmfhd.Mfgr_pt_no NOT IN (SELECT Bomparent+Uniq_key+PartMfgr+Mfgr_pt_no FROM AntiAvl) ;
UNION ;
*-- This gathers internal part numbers and AVL for the BOM
 
SELECT Bom_det.Bomparent,Bom_det.uniq_key,Bom_det.qty,IA.BomCustno as AssemblyCust,;
 IA.part_no as AssemblyNo,IA.Revision as AssemblyRev,Bom_det.item_no,;
 IC.Part_sourc,IC.Part_no,IC.Revision ,SPACE(10) as ConsgUniq ,;
 Invtmfhd.PartMfgr,Invtmfhd.Mfgr_pt_no;
FROM Bom_det,Inventor IA, Inventor IC ,Invtmfhd;
WHERE Bom_det.Bomparent=IA.Uniq_key ;
 AND Bom_Det.Uniq_key=IC.Uniq_key ;
 AND Invtmfhd.Uniq_key=IC.uniq_key;
 AND IA.Part_no= lcPart_no;
 AND IA.Revision=lcrevision;
 AND Ic.Uniq_key NOT IN (SELECT Int_uniq FROM Inventor WHERE part_sourc='CONSG'); 
 AND BomParent+IC.uniq_key+Invtmfhd.PartMfgr+Invtmfhd.Mfgr_pt_no NOT IN (SELECT Bomparent+Uniq_key+PartMfgr+Mfgr_pt_no FROM AntiAvl) ;
ORDER BY 7;
INTO CURSOR ZBom
1.4. BOM Query - Inventory not used on BOM Query

This SQL will just find all the items from inventory, which are not used as a BOM components. The SQL is not tested and might have typos.   

SELECT Inventor.Status,Inventor.Uniq_key,;
            IIF(Inventor.Part_sourc="CONSG",CustPartNo,Part_No) AS Part_no,;
            IIF(Inventor.Part_sourc="CONSG",CustRev,Revision) AS Revision,;
             Part_class,Part_type,Descript,StdCost,Part_sourc,Buyer_type as
Buyer,;
             Custno,U_of_Meas,SUM(InvtMfgr.Qty_oh) AS
TotQty_Oh,ROUND(SUM(InvtMfgr.Qty_oh * StdCost),2) AS Ext_cost  ;
            FROM Inventor, InvtMfgr ;
WHERE Part_sourc<>"MAKE" ;
            AND InvtMfgr.Uniq_Key == Inventor.Uniq_Key ;
            AND Inventor.Uniq_key NOT IN;
            (SELECT Uniq_key FROM Bom_det ;
                        WHERE IIF(EMPTY(Eff_dt) AND
EMPTY(Term_dt),.T.,IIF(!EMPTY(Eff_dt) AND !EMPTY(Term_dt),Eff_dt<=Date() AND
Term_dt>Date(),IIF(EMPTY(Eff_dt),Term_dt>Date(),Eff_dt<=Date()))));
            AND !Invtmfgr.Is_Deleted ;
GROUP BY 1,2,3,4,5,6,7,8,9,10,11,12;
ORDER BY Part_class,Part_type,3,4;
INTO CURSOR Zinvrep
1.5. Email Log Table that can be used to create a custom report
 

The EmailLog Table is available within the DBFS directory that users should be able to use to create a quick and simple Custom report in order to make their records of emails sent out of the ManEx system more viewable.  If users have Crystal Reports software, they should then be able to group/sort the email log as desired.  For example:  Group on the creportnm would group all Packing List related emails together.  Or, if they sorted per cuserinit you could see all emails sent out of the system per a particular user, etc. . . .

1.6. How are the Packing List details related back to the SO delivery schedule?
Q.  How are the Pack List details related back to the Sales Order delivery schedule?

A.  Shipments are tied to the SO line item and NOT the SO line item schedules, so you cannot create a direct connect.  This is to allow users to ship against multiple delivery dates on a single packing list without creating multiple line items.    So you will NOT find a corresponding unique field in these tables.  User will need to use some type of FIFO to match shipments against SO line items and apply them in order to the SO line item schedules. 
 
For example:

SO                   SO Item          Due Date        Qty Due
0000000052        1                  02/05/09              10
0000000052        1                  02/15/09              10
0000000052        1                  03/01/09              10                   

SO                   SO Item          Ship Date       Qty Shipped Packing List
0000000052        1                  02/15/09              15                0000012345
0000000052        1                  03/01/09              15                0000012359

Would look like this:

SO                   SO Item          Due Date        Qty Due          PL Number    Shipped Date                    Ship Qty     On-Time         % On-Time
0000000052        1                  02/05/09              10                0000012345        02/15/09                               10                N                       0%
0000000052        1                  02/15/09              10                0000012345        02/15/09                               05                Y                       50%
0000000052        1                  02/15/09              10                0000012359        03/01/09                               05                N                          0%
0000000052        1                  03/01/09              10                0000012359        03/01/09                               10                Y                     100%
 
1.7. How does ManEx handle the Shipped quantity on the Sales order side?
Q.  How does ManEx handle the Shipped quantity on the Sales order side?

A.  For our on-time report in eManEx we do it in a FIFO fashion.  ManEx adds the shipped qty to the earliest due date first.  To create a report, other users have created a separate table that will use this method to match up shipments with deliveries and allow on-time reporting.
1.8. How can I Create an On-Time Report using the Shipping & SO Data?
Q.  How can I Create an On-Time Report using the Shipping & SO Data?”
 
See Article #3180
1.9. ICM Query - Inventory Basic Table Query

CLOSE DATABASES all
CLEAR

*pn = "134-0000450"

USE invtmfgr ORDER tag uniqmfgrhd
BROWSE LAST nowait

SELECT 0
USE invtmfsp ORDER tag uniqmfgrhd
BROWSE LAST nowait

SELECT 0
USE invtmfhd ORDER tag uniq_key
SET RELATION TO  uniqmfgrhd INTO invtmfgr
SET RELATION TO  uniqmfgrhd INTO invtmfsp additive

BROWSE LAST nowait

SELECT 0
USE invt_isu ORDER tag uniq_key
BROWSE LAST nowait

SELECT 0
USE invt_rec ORDER tag uniq_key
BROWSE LAST nowait

SELECT 0
USE inventor ORDER tag part_no
SET RELATION TO uniq_key INTO invtmfhd
SET RELATION TO uniq_key INTO invt_isu addi
SET RELATION TO uniq_key INTO invt_rec addi

*SEEK pn
BROWSE LAST nowait


** or....
SELECT inventor.part_class, inventor.Part_type, inventor.Part_no, inventor.Revision, ;
  inventor.custno, inventor.custpartno, inventor.descript, inventor.status, inventor.stdcost, ;
 Invtmfhd.partmfgr, Invtmfhd.Mfgr_pt_no, ;
 invtmfgr.whno, invtmfgr.qty_oh, invtmfgr.reserved, ;
 invtmfsp.supid, invtmfsp.suplpartno ;
 FROM inventor, invtmfhd,invtmfgr,invtmfsp;
 WHERE inventor.Uniq_key = invtmfhd.uniq_key;
  AND invtmfhd.uniqmfgrhd = invtmfgr.uniqmfgrhd;
  AND invtmfsp.uniqmfgrhd = invtmfhd.uniqmfgrhd;
 ORDER BY part_no,revision,partmfgr,whno;
 INTO CURSOR partslist
 
BROWSE LAST nowait

1.10. ICM Query - Item Master Report Query
Report layout information that was provided
Item Master Report - Customer part number, EMI part number, part description, supplier name or supplier code, mfr name, mfr part number, currency, unit price, lead time, MOQ, SPQ (order multiple), period order (order frequency), quoted date
 
Suggested report query to apply
This is a complex request. The main table for inventory is in the INVENTOR table. However, this is a little complex, as we will have one record for the Internal Part Number, and may have many records for multiple customer part numbers for the same part. The Customer part number is maintained as a consigned part type in the same table. The link between the internal part number record and the customer part number record is found in the Int_uniq field of the consigned part number, which refers to the uniq_key of the internal part number.

 The Manufacturer name and part number are contained in the INVTMFHD table. Records in this table are linked to the internal part number records in the INVENTOR table by the uniq_key.

 The Supplier information is kept in the INVTMFSP table, and is linked to the Manufacturer in the INVTMFHD table by the uniqmfgrhd field.

The unit price, lead time, minimum order quantity, order multiple, MRP Order Policy Code are all in the INVENTOR table.  We do not have a field for currency.

The“quoted date” is not readily available. It is assumed that this means the date that the component was quoted within the quote module. But this depends on a large number of factors, such as which assembly the part is being used in, which customer, which sales order, which version of the quote, and which supplier quote
1.11. ICM Query-The Hierarchies of Inventory Tables in ManEx
Inventory tables in ManEx:
1.  Inventor - Table contains Part number, type, class, revision, etc information.  Unique identifier for each record is the value of the UNIQ_KEY

2.  Invtmfhd - Table contains MPN information.  Unique identifier of each record in the table is UNIQMFGRHD. Link to the Inventor table by UNIQ_KEY.

3.  InvtMfgr - Table contains WH/Location and quantities information for each MPN.  Unique identifier of each record W_KEY.  Link to the InvtMfhd using UNIQMFGHD.




1.12. ICM Query - Transaction Detail Log Report
SELECT part_no, revision, whno, qtyisu, date, issuedto , transref;
 FROM invt_isu, inventor;
 WHERE invt_isu.uniq_key = inventor.uniq_key;
 INTO CURSOR seeissues
BROWSE last
 
SELECT part_no, revision, warehouse, qtyrec, date, commrec , transref;
 FROM invt_rec, inventor;
 WHERE invt_rec.uniq_key = inventor.uniq_key;
 INTO CURSOR seereceipts
BROWSE last

SELECT
part_no, revision,  qtyxfer, date, reason , transref;
 FROM invttrns, inventor;
 WHERE invttrns.uniq_key = inventor.uniq_key;
 INTO CURSOR seetransfers
BROWSE last
 

Once you have this information setup , you can expand it to include serial numbers, lot codes, initials, etc.

1.13. ICM Query - Link to where PN# is used on BOM

If you are looking to link the part number from ICM to where it is used on BOM It starts with the Bom_det table. In this table, the Uniq_key is the component, the BOMParent is the assembly (both uniq_keys). But this info will only give you one level up.  So you should be able to link the bomparent key back to the inventor table to get the assembly part number. 

1.14. ICM Query - Find a customer part number for an internal part
The customer part number is linked within the inventor table by the int_uniq field and the custno. So to find a customer part number for an internal part, search for the custno and int_uniq that matches the internal uniq_key 
1.15. ICM Query - Find serial #’s that exist in stock currently for all parts/product
 
The following query will display which serial numbers exist in stock currently for all parts/products. 


SELECT
part_no,revision,Partmfgr,mfgr_pt_no,invtmfgr.whno,warehouse,w_key,location,qty_oh,serialno;

from inventor;

INNER JOIN invtmfhd ON inventor.uniq_key = invtmfhd.uniq_key;

inner JOIN invtmfgr ON invtmfhd.uniqmfgrhd = invtmfgr.uniqmfgrhd;

inner JOIN warehous ON invtmfgr.uniqwh = warehous.uniqwh;

left OUTER JOIN invtser ON invtmfgr.w_key = invtser.id_value;

WHERE inventor.status = 'Active';

AND invtmfhd.is_deleted <> .t.;

and invtmfgr.is_deleted <> .t.;

AND qty_oh <> 0.00;

AND serialyes = .t.

1.16. ICM Query - PO History Button Sequel Statement

Here is the sequel statement that generates the information in the PO History button from the inventory page 2 screen.  The uniq_key is the field identifying the part you are looking for.  In this sequel, records are gathered up to ten records. You can change the sequel if you would like less records.

SELECT TOP 10 Pomain.podate, Supinfo.supname, Pomain.ponum,;
  Poitems.partmfgr, Poitems.costeach, Poitems.ord_qty, Poitems.mfgr_pt_no;
FROM ;
    manex!pomain,;
    manex!supinfo,;
    manex!poitems;
 WHERE ( ( (  Pomain.ponum == Poitems.ponum;
   AND  Supinfo.uniqsupno == Pomain.uniqsupno );
   AND  Poitems.uniq_key == ( ?gUniq_key ) );
   AND  NOT (Poitems.lcancel ) );
   AND  (  Pomain.postatus = ( "OPEN" );
   OR  Pomain.postatus = ( "CLOSED" ) );
 ORDER BY Pomain.podate DESC
1.17. ICM Query - Total Demands by Part Number
  
Q.    I am trying to determine the Total Demands by Part Number, regardless of Inventory or POs.  Can you direct me to the proper data element and and table
A   MRPACT table would contain the Demand information
       To get the Part Number and/or AVL information you would have to link the uniq_key fields to the INVENTOR and/or INVTMFHD Tables
1.18. INVT HANDLING - Are there fields available that record the “Issue Account Description” selected for the Receiving and Issuing transaction records from the Inventory Handling module.
Q  -  Are there fields available that record the “Issue Account Description” selected for the Receiving and Issuing transaction records from the Inventory Handling module?


A.  - We do not record the “Issue Account Description” from the Receiving and Issuing transactions in the Inventory Handling module within any tables. Only the account number is recorded into the transaction record. The account descriptions are only used to identify the account used in the transaction. See attached Print Screens  <<PS_96_081117_a.docx>> for the Issue-Reference and the Receiving-Reasons.   

 
 
1.19. KITTING Query - How to create a query to view items that have been Kitted

If the objective is to view items that have been KITTED, then this information resides in the kalocate table. This table is linked to the kamain table by the kaseqnum field. The kamain table contains work order, dept_id actual quantity and date, and uniq_key. The uniq_key is linked to the inventor table to find the part number and revision.
Also in the kalocate table is the W-key, which links to invtmfgr table and warehouse/location information. Also is the uniqmfgrhd, which links to the invtmfhd table where the AVL information is contained.

1.20. MRP Query - MRP table information
Request:   
Can you give me a list of all of the tables for MRP and relationships between the tables?
 

Response:

ManEx is available upon request to provide simple queries.  But when it involves MRP demands, that is anything but simple.  The method in which the ManEx system compiles the MRP information is very complex with 1000’s of lines of codes that the system goest through to provide the correct demand for the parts within the system.  Every file used by Inventory, Purchasing, Work Orders, Kitting, Sales orders and Forecasts are used in the MRP Generation. All information from each file is gathered and incorporated in the tables beginning with “MPS” and “MRP”. The data in these tables are further managed by logic rules that are very complex relationships.

ManEx does not have the resources to in providing the users with the Possible 1000’s plus line of SQL statements that would ben needed to get the end results of MRP, but if the nature of the information sought after is explained in further detail, there is the possiblity that more specific table/releationships can be provided.   

You may find partial answers in the tables mrpsch2 and mpract. 

1.21. PO Query - Purchase Order Basic Table Query

*seepos
clear
close all
set safety off
public m.pono
m.pono = space(10)

@ 12,12 SAY "ENTER Purchase Order :" GET m.pono
READ
m.pono = padl(alltrim(m.pono),15,"0")
? m.pono
* CLEAR
 
SET STEP ON

use pomain order tag ponum in 0
use poitems order tag ponum in 0

sele pomain
set relation to ponum  into poitems

seek m.pono

brow last nowait

use poitschd order tag uniqlnno in 0
use porecdtl order tag uniqlnno in 0
use porecloc order tag uniqdetno in 0
use poreclot in 0
use podock order tag uniqlnno in 0
use porecmrb order tag DMR in 0
use invtmfgr order tag uniqmfgrhd in 0
USE INVENTOR ORDER TAG UNIQ_KEY IN 0
use invtlot order tag w_keylot in 0
use invt_rec order tag uniqmfgrhd IN 0

sele poitems
set relation to uniqlnno into poitschd
set relation to uniqlnno into porecdtl additive
set relation to uniqlnno into podock additive
SET RELATION TO UNIQ_KEY INTO INVENTOR ADDITIVE
set relation to uniqmfgrhd into invtmfgr addi
set relation to uniqmfgrhd into invt_rec addi
sele invtmfgr
set relation to w_key into invtlot
sele poitschd
set relation to uniqdetno into porecloc
sele porecdtl
set relation to transno into porecmrb

sele poitschd
brow last NOWAIT
sele porecdtl
brow last NOWAIT
sele porecloc
brow last NOWAIT
sele podock
brow last NOWAIT
sele poitems
brow last NOWAIT
sele porecmrb
brow last NOWAIT
SELE INVENTOR
BROW LAST NOWAIT
SELE INVtmfgr
BROW LAST NOWAIT
SELE invtlot
brow last nowait

1.22. PO Query - Purchase Price Variance by Project

SQL Syntax that could be used for creating a listing by project of all Purchasing Variances for items purchased ON THE PO to the project.

 

 

ldbegdt = {^2007/01/01}  &&& Oldest date to include information

 

SELECT pur_var.ponum, pur_var.itemno, pur_var.part_no, pur_var.acpt_qty, pur_var.costeach, pur_var.stdcost, pur_var.variance,;

      poitems.uniqlnno, poitschd.requesttp, poitschd.woprjnumber;

      FROM pur_var, poitems, poitschd;

      WHERE trans_date > ldbegdt;

            AND pur_var.ponum = poitems.ponum;

            AND pur_var.itemno = poitems.itemno;

            AND poitschd.uniqlnno = poitems.uniqlnno;

            AND poitschd.requesttp = "Prj Alloc";

      ORDER BY woprjnumber, pur_var.part_no;

      INTO CURSOR pvlist

 

 

Also, in order to see this information, the PO Reconciliations must have been completed, and the information transferred to Accounts Payable
1.23. PO Query - Last Paid Purchase Order Price Query

 

 

SQL Syntax that could be used for creating a listing by project of all Purchasing Variances for items purchased ON THE PO to the project.

 

SELECT costeach, ord_qty, part_no, schd_date;

      FROM poitschd, poitems;

      WHERE poitschd.uniqlnno = poitems.uniqlnno;

      order by parT_no,schd_date;

      into cursor getstuff

 

SELECT costeach, ord_qty, part_no, schd_date ;

FROM getstuff;

where schd_date IN (SELECT MAX(schd_date) FROM getstuff A1 WHERE A1.part_no=getstuff.part_no);

order BY part_no;

into CURSOR lastprice

 

Keep in mind that sometimes the last price may have been a panic buy and may cost more than the usual price. And bear in mind that this will be the last price on a PO whether or not it was received, and not necessarily what the actual price was if accounting modified the invoice in AP.

1.24. PO Query - Open PO Dock Receiving Report
Below is the SQL Query for the Open Purchase Order Dock Receiving Report
 
 
SELECT Podock.Ponum, SupInfo.Supname, Poitems.Itemno, Podock.Qty_rec, Podock.Date, Podock.Porecpkno, Podock.Receiverno, ;
Pomain.Conum,Poitems.PartMfgr,Poitems.Mfgr_pt_no, ;
IIF(EMPTY(Poitems.Uniq_key),SPACE(10),Poitems.Uniq_key) AS Uniq_key, ;
IIF(EMPTY(Poitems.Uniq_key),Poitems.Part_no,Inventor.Part_no) AS Part_no, ;
IIF(EMPTY(Poitems.Uniq_key),Poitems.Revision,Inventor.Revision) AS Revision, ;
IIF(EMPTY(Poitems.Uniq_key),Poitems.Part_class,Inventor.Part_class) AS Part_class, ;
IIF(EMPTY(Poitems.Uniq_key),Poitems.Part_type,Inventor.Part_type) AS Part_type, ;
IIF(EMPTY(Poitems.Uniq_key),Poitems.Descript,Inventor.Descript) AS Descript ;
FROM Manex!Podock, Manex!Pomain, Manex!Supinfo, ;
Manex!Poitems LEFT OUTER JOIN Manex!Inventor ;
ON Poitems.Uniq_key = Inventor.Uniq;
WHERE Pomain.UniqSupno = Supinfo.UniqSupno ;
AND Poitems.Ponum = Pomain.Ponum ;
AND Podock.Uniqlnno = Poitems.Uniqlnno ;
AND Podock.ponum = Poitems.Ponum ;
AND EMPTY(Podock.CompDate) ;
INTO CURSOR ZPoDockOp
1.25. PO Query - Linking the PO Receiving Tables to the PO Tables
The records from the porecdtl table can be linked to the poitems table by the field uniqlnno. And the PO number can be determined from the poitems table.
 
There is a connection between PO receiving and PO schedule table.  The link is in the Porecloc.Uniqdetno=Poitschd.Uniqdetno. In Poitschd table.  There also is a link for CompleteDt field which will have the data when all the quantities for that schedule are received.  
 
However, due to the many different opinions as to what exactly the complete date is and how to measure supplier's performance we are unable to create a "Vendor On-Time Delivery Report".  In the effort of doing something towards this issue we have saved the original commit date, because the schedule date is really a moving target and it just reflect when the supplier is finally going to deliver, but it doesn't mean that it was what they promised. 

The reason is that it is usually the case where the supplier ships and the product is received at a date earlier or later than the scheduled date. And they may not ship enough, or may overship against the next order. Here’s an example:
 

schedule

qty

Receipts

qty

remainder

1-May

100

30-Apr

80

-20

10-May

50

30

15-May

150

-120

16-May

200

80

19-May

150

230

20-May

200

30

1-Jun

150

1-Jun

120

0

5-Jun

200

200

10-Jun

200

0


In this case, the May 1st schedule was shipped early, but not complete. It was made up by May 10th.
May 15th was missed, unless you count the 30 extras from May 10th. Then it was overshipped  on the 16th.
The May 20th schedule was shipped a day early, with excess quantity.
The June 1st  had some excess from the previous shipment, and got caught up on schedule and quantity
The June 10th schedule was received 5 days early.
 
Some users want to only measure what came in on the day of the schedule, and only count it if it is 100 percent complete.  Others will allow a tolerance of a couple of days early to a day or so late, and still count as on tiem.  So it's difficult to come up with the scheme that will work for every user.
 
 
1.26. SQC Related Queries
1.26.1. Yield Detail Report by Customer By Date Range query
 

SELECT Custname, Qainsp.Wono, Part_no, Revision, LotSize, InspQty, FailQty, PassQty, Yield, Dept_name, Date, Qaseqmain AS QALink ;
 FROM Qainsp, Woentry, Inventor, Customer, Depts ;
 WHERE Inventor.Uniq_key = Woentry.Uniq_key ;
 AND Woentry.Custno = Customer.Custno ;
 AND Qainsp.Wono = Woentry.Wono ;
 AND Qainsp.Dept_id = Depts.Dept_id ;
 AND Date >= dStart AND Date <= dEnd ;
 AND Qainsp.Dept_id IN (SELECT Dept_id FROM ZD) ;
 AND Woentry.Custno IN (SELECT Custno FROM ZCu) ;
 AND Qainsp.Wono IN (SELECT Wono FROM ZW) ;
 ORDER BY Date, Custname, Part_no ;
 INTO CURSOR ZYieldDt

1.26.2. Defect Location Report by Customer by Assembly Query
 

  Qadefloc.LocQty, Qadefloc.Location, Qadef.DefDate, Depts.Dept_name, Depts.Number, Qadef.Wono ;
 FROM Customer, Inventor, Qadef, Support, Qadefloc, Woentry, Depts ;
 WHERE Customer.Custno = Woentry.Custno ;
 AND Woentry.Uniq_key = Inventor.Uniq_key ;
 AND Woentry.Wono = Qadef.Wono ;
 AND Qadef.Locseqno = Qadefloc.Locseqno ;
 AND Qadefloc.Def_code = LEFT(Support.Text2,10) ;
 AND Support.Fieldname = "DEF_CODE  " ;
 AND (DefDate >= (dStart) AND DefDate <= (dEnd)) ;
 AND Woentry.Custno IN (SELECT Custno FROM ZC) ;
 AND Qadefloc.ChgDept_id = Depts.Dept_id ;
 AND Qadefloc.ChgDept_id IN (SELECT Dept_id FROM ZD) ;
 ORDER BY CustName, Depts.Number, Part_no, Revision, Def_code ;
 INTO CURSOR Zqaloc

1.27. Supplier Master Report Query
Report layout information that was provided 
Supplier Master Report - supplier code, supplier name, phone no., fax no., e-mail address, contact name (s), address, payment terms, freight terms etc.
 
Suggested report query to apply
The main supplier database is in the SUPINFO table. These records link to the SHIPBILL table via the R_link and C_link fields, where details of  the multiple ship-to and bill-to addresses are kept. The contacts are maintained in the CCONTACT table, linked to the customer by the custno field.
1.28. WO Query - Work Order Stat Basic Query

 

 

SELECT woentry.custno, woentry.wono, woentry.openclos, woentry.due_date, woentry.bldqty, woentry.balance, ;

       woentry.reledate,;

      inventor.parT_no, inventor.revision, inventor.descript, ;

       woentry.sono,due_dts.due_dts as SOdueDt,due_dts.commit_dts as SO_commdt,due_dts.qty as SOqty;

      FROM woentry,inventor,due_dts;

      WHERE openclos <> "Closed" and openclos <> "Cancel";

            and inventor.uniq_key = woentry.uniq_key;

            AND due_dts.uniqueln = woentry.uniqueln;

      ORDER BY woentry.wono;

      INTO CURSOR wostuff

BROWSE LAST nowait

 

 

     

** work center locations

 

SELECT wostuff.wono,dept_id, curr_qty;

      FROM wostuff, dept_qty;

      WHERE wostuff.wono = dept_qty.wono;

      ORDER BY wostuff.wono,dept_id;

      INTO CURSOR whereitis

     

BROWSE LAST nowait

 

** wo shortages

 

SELECT distinct wostuff.wono,kamain.dept_id,kamain.shortqty,;

      inventor.part_no, inventor.revision, kamain.uniq_key;

      FROM wostuff, kamain, kadetail, inventor;

      WHERE wostuff.wono = kamain.wono;

            AND kamain.kaseqnum = kadetail.kaseqnum;

            AND kamain.uniq_key = inventor.uniq_key;

            AND kamain.shortqty > 0;

      ORDER BY wostuff.wono,inventor.part_no;

      INTO CURSOR whatitis

     

BROWSE LAST nowait

 

 

 

SELECT WHATITIS.WONO, WHATITIS.PART_NO, WHATITIS.SHORTQTY, poitems.ponum, POMAIN.POSTATUS,  ;

      poitems.itemno,poitschd.balance, ;

      poitschd.schd_date, SUPINFO.SUPNAME ;

      from poitems, pomain, POITSCHD, SUPINFO, WHATITIS;

      where POITEMS.PONUM = POMAIN.PONUM;

            AND POITSCHD.UNIQLNNO = POITEMS.UNIQLNNO;

            AND POMAIN.postatus <> "CANCEL" ;

            AND POMAIN.postatus <> "CLOSED" ;

            AND POITSCHD.BALANCE > 0;

            AND SUPINFO.UNIQSUPNO = POMAIN.UNIQSUPNO;

            AND POITEMS.UNIQ_KEY = WHATITIS.UNIQ_KEY;

      ORDER BY WHATITIS.WONO, WHATITIS.PART_NO,POITEMS.PONUM,POITEMS.ITEMNO,POITSCHD.SCHD_DATE;

      INTO CURSOR WHENISIT

     

BROWSE LAST NOWAIT

1.29. Query Information that could be used for custom Shipping Labels
Some Information that could be used on Custom Shipping Labels. 
 
 

SELECT     dbo.PLMAIN.PACKLISTNO, dbo.SHIPBILL.SHIPTO, dbo.SHIPBILL.ADDRESS1, dbo.SHIPBILL.ADDRESS2, dbo.SHIPBILL.CITY, dbo.SHIPBILL.STATE,

                      dbo.SHIPBILL.ZIP, dbo.CCONTACT.LASTNAME, dbo.CCONTACT.FIRSTNAME, dbo.SHIPBILL.SHIPVIA, dbo.SHIPBILL.E_MAIL, dbo.SOMAIN.SONO,

                      dbo.SOMAIN.PONO, dbo.INVENTOR.PART_NO, dbo.INVENTOR.REVISION

FROM         dbo.CCONTACT RIGHT OUTER JOIN

                      dbo.PLMAIN INNER JOIN

                      dbo.PLDETAIL ON dbo.PLMAIN.PACKLISTNO = dbo.PLDETAIL.PACKLISTNO ON dbo.CCONTACT.CID = dbo.PLMAIN.ATTENTION LEFT OUTER JOIN

                      dbo.INVENTOR LEFT OUTER JOIN

                      dbo.SODETAIL ON dbo.INVENTOR.UNIQ_KEY = dbo.SODETAIL.UNIQ_KEY ON dbo.PLDETAIL.UNIQUELN = dbo.SODETAIL.UNIQUELN LEFT OUTER JOIN

                      dbo.SOMAIN ON dbo.PLMAIN.SONO = dbo.SOMAIN.SONO LEFT OUTER JOIN

                      dbo.SHIPBILL ON dbo.PLMAIN.LINKADD = dbo.SHIPBILL.LINKADD