/*
Here is a Progress 4gl/crystal report SINGLE LEVEL BOM program for vantage.
The first time you run the program, the BOM.CSV file will be created in
c:\vntgwork, and you will get an error because BOM.rpt does not yet exist.
After the program is run for the first time, use the instructions below to
connect to the BOM.CSV file in crystal through ADO. You will need to change
"c:\temp\bom.rpt" to reflect the path of the actual crystal report.
I have written some indented BOM code, but have not yet implemented it with
a crystal report. I may post an indented version if I get the time.
One could make a vantagebasic button in the part or partrev modules, and add
in the code to retrieve the current part record. Note that this program
only grabs the latest revision (by effectivedate).
This is code is AS IS, and is not officially supported by myself. Feel free
to e-mail me at tjacobs@... with questions, but it may be a while
before I respond.
HTH,
Thaddeus
*/
/*--------Begin CODE---------*/
PROCEDURE GetUserNameA EXTERNAL "advapi32.dll":U:
DEFINE INPUT-OUTPUT PARAMETER ipBuffer AS CHAR.
DEFINE INPUT-OUTPUT PARAMETER ipSize AS LONG.
END PROCEDURE.
def var pn like partrev.partnum.
def var prev like partrev.revisionnum.
def var ibomseq as integer initial 0.
def var level as integer initial 0.
def var blankstring as char initial "".
def var zero as integer initial 0.
def var lvuserid as char no-undo.
def buffer bufPartRev for partrev.
def buffer bufpart for part.
DEF VAR lvFill AS INT NO-UNDO INITIAL 25.
lvUserID = FILL(" ":U, lvFill).
RUN GetUserNameA (INPUT-OUTPUT lvUserID, INPUT-OUTPUT lvFill).
DEFINE BUTTON btn-OK LABEL "OK".
DEFINE FRAME Frame1
pn
btn-OK
WITH SIDE-LABELS CENTERED WIDTH 30 TITLE "BOM" VIEW-AS DIALOG-BOX.
DISPLAY pn WITH FRAME Frame1.
ENABLE ALL WITH FRAME Frame1.
WAIT-FOR CHOOSE OF btn-OK.
assign pn.
find part where part.company = "001" and part.partnum = pn.
output to c:\vntgwork\bom.csv.
export delimiter ","
"IbomSeq" "Level" "Item" "Ref" "PartNum" "Rev" "Description" "Qty" "IUM"
"User"
"AssyPartNum" "AssyRev" "AssyDescription" "DrawnBy".
for each partrev no-lock of part break
by partrev.partnum
by partrev.effectivedate:
end.
export delimiter "," ibomseq level zero blankstring blankstring blankstring
blankstring zero blankstring lvuserid partrev.partnum partrev.revisionnum
substring(part.partdescription, 1, 30) partrev.draw.
for each partmtl of partrev no-lock:
for each bufpartrev no-lock where
bufpartrev.company = "001" and
bufpartrev.partnum = partmtl.mtlpartnum
break
by bufpartrev.partnum
by bufpartrev.effectivedate:
end.
find bufpart no-lock of bufpartrev.
ibomseq = ibomseq + 1.
level = 1.
export delimiter "," ibomseq level partmtl.mtlseq partmtl.bubble
partmtl.mtlpartnum
bufpartrev.revisionnum substring(bufpart.partdescription, 1, 30)
partmtl.qtyper bufpart.ium lvuserid partrev.partnum partrev.revisionnum
substring(part.partdescription, 1, 30) partrev.draw.
end.
output close.
def var App as com-handle no-undo.
def var report as com-handle no-undo.
/*open the crystal print engine*/
create "Crystal.CRPE.Application" app.
/*open report file and preview it*/
report = app:OpenReport("c:\temp\bom.rpt").
.
report:preview("BOM" , , , , , , 0).
quit.
/*if you release the object handles, the report window will close.
You can simply create a crystal report named BOM.RPT based on the bom.csv
export (assuming you have crystal 8 or greater).
Rather than using the ODBC microsoft text driver, or linking access tables,
I prefer to use the ADO jet driver to reference CSV files.
Go Database->set location->set location->more data sources->
Active Data->Active Data(ADO)->make new connection.
Select "ADO OLEDB"
in the connection string field paste:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\vntgwork\;Extended
Properties="text;HDR=Yes;FMT=Delimited;";
Click OK (Do not click BUILD)
you are then prompted with a dropdown list of csv files. Check SQL Query
instead, and type
Select * from bom.csv
The rest is the same as usual.*/
Here is a Progress 4gl/crystal report SINGLE LEVEL BOM program for vantage.
The first time you run the program, the BOM.CSV file will be created in
c:\vntgwork, and you will get an error because BOM.rpt does not yet exist.
After the program is run for the first time, use the instructions below to
connect to the BOM.CSV file in crystal through ADO. You will need to change
"c:\temp\bom.rpt" to reflect the path of the actual crystal report.
I have written some indented BOM code, but have not yet implemented it with
a crystal report. I may post an indented version if I get the time.
One could make a vantagebasic button in the part or partrev modules, and add
in the code to retrieve the current part record. Note that this program
only grabs the latest revision (by effectivedate).
This is code is AS IS, and is not officially supported by myself. Feel free
to e-mail me at tjacobs@... with questions, but it may be a while
before I respond.
HTH,
Thaddeus
*/
/*--------Begin CODE---------*/
PROCEDURE GetUserNameA EXTERNAL "advapi32.dll":U:
DEFINE INPUT-OUTPUT PARAMETER ipBuffer AS CHAR.
DEFINE INPUT-OUTPUT PARAMETER ipSize AS LONG.
END PROCEDURE.
def var pn like partrev.partnum.
def var prev like partrev.revisionnum.
def var ibomseq as integer initial 0.
def var level as integer initial 0.
def var blankstring as char initial "".
def var zero as integer initial 0.
def var lvuserid as char no-undo.
def buffer bufPartRev for partrev.
def buffer bufpart for part.
DEF VAR lvFill AS INT NO-UNDO INITIAL 25.
lvUserID = FILL(" ":U, lvFill).
RUN GetUserNameA (INPUT-OUTPUT lvUserID, INPUT-OUTPUT lvFill).
DEFINE BUTTON btn-OK LABEL "OK".
DEFINE FRAME Frame1
pn
btn-OK
WITH SIDE-LABELS CENTERED WIDTH 30 TITLE "BOM" VIEW-AS DIALOG-BOX.
DISPLAY pn WITH FRAME Frame1.
ENABLE ALL WITH FRAME Frame1.
WAIT-FOR CHOOSE OF btn-OK.
assign pn.
find part where part.company = "001" and part.partnum = pn.
output to c:\vntgwork\bom.csv.
export delimiter ","
"IbomSeq" "Level" "Item" "Ref" "PartNum" "Rev" "Description" "Qty" "IUM"
"User"
"AssyPartNum" "AssyRev" "AssyDescription" "DrawnBy".
for each partrev no-lock of part break
by partrev.partnum
by partrev.effectivedate:
end.
export delimiter "," ibomseq level zero blankstring blankstring blankstring
blankstring zero blankstring lvuserid partrev.partnum partrev.revisionnum
substring(part.partdescription, 1, 30) partrev.draw.
for each partmtl of partrev no-lock:
for each bufpartrev no-lock where
bufpartrev.company = "001" and
bufpartrev.partnum = partmtl.mtlpartnum
break
by bufpartrev.partnum
by bufpartrev.effectivedate:
end.
find bufpart no-lock of bufpartrev.
ibomseq = ibomseq + 1.
level = 1.
export delimiter "," ibomseq level partmtl.mtlseq partmtl.bubble
partmtl.mtlpartnum
bufpartrev.revisionnum substring(bufpart.partdescription, 1, 30)
partmtl.qtyper bufpart.ium lvuserid partrev.partnum partrev.revisionnum
substring(part.partdescription, 1, 30) partrev.draw.
end.
output close.
def var App as com-handle no-undo.
def var report as com-handle no-undo.
/*open the crystal print engine*/
create "Crystal.CRPE.Application" app.
/*open report file and preview it*/
report = app:OpenReport("c:\temp\bom.rpt").
.
report:preview("BOM" , , , , , , 0).
quit.
/*if you release the object handles, the report window will close.
You can simply create a crystal report named BOM.RPT based on the bom.csv
export (assuming you have crystal 8 or greater).
Rather than using the ODBC microsoft text driver, or linking access tables,
I prefer to use the ADO jet driver to reference CSV files.
Go Database->set location->set location->more data sources->
Active Data->Active Data(ADO)->make new connection.
Select "ADO OLEDB"
in the connection string field paste:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\vntgwork\;Extended
Properties="text;HDR=Yes;FMT=Delimited;";
Click OK (Do not click BUILD)
you are then prompted with a dropdown list of csv files. Check SQL Query
instead, and type
Select * from bom.csv
The rest is the same as usual.*/