379 lines
10 KiB
Plaintext
379 lines
10 KiB
Plaintext
COMPILE SUBROUTINE Print_Comm_Invoice( ShipNo, PrintOnly, PrintPath, PDFFileName, PrinterInitialized)
|
|
|
|
DECLARE FUNCTION FieldCount, Msg, Set_Printer, Get_Printer, obj_RDS_Test
|
|
DECLARE FUNCTION Printer_Select, obj_Install,obj_RDS, obj_Invoice
|
|
DECLARE SUBROUTINE extract_si_keys, record_lock, Btree.Extract, ErrMsg
|
|
|
|
|
|
$INSERT MSG_EQUATES
|
|
$INSERT RDS_EQU
|
|
$INSERT RDS_LAYER_INFO_EQU
|
|
$INSERT PROD_SPEC_EQU
|
|
$INSERT OIPRINT_EQUATES
|
|
$INSERT NCR_EQU
|
|
$INSERT POPUP_EQUATES
|
|
$INSERT LOGICAL
|
|
$INSERT COA
|
|
$INSERT COC_EQU
|
|
|
|
$INSERT RDS_TEST_EQUATES
|
|
$INSERT RDS_LAYER_EQUATES
|
|
$INSERT WO_LOG_EQU
|
|
$INSERT WO_STEP_EQU
|
|
$INSERT WM_OUT_EQUATES
|
|
$INSERT SURFACE_SCAN_EQUATES
|
|
|
|
EQU COMM_INVOICE_SHIP_TO$ TO 1
|
|
EQU COMM_INVOICE_PHONE_TYPE$ TO 2
|
|
EQU COMM_INVOICE_PHONE_NO$ TO 3
|
|
EQU COMM_INVOICE_SHIP_DT$ TO 4
|
|
EQU COMM_INVOICE_PO$ TO 5
|
|
EQU COMM_INVOICE_SHIP_NO$ TO 6
|
|
EQU COMM_INVOICE_ORIGIN$ TO 7
|
|
EQU COMM_INVOICE_SHIP_VIA$ TO 8
|
|
EQU COMM_INVOICE_ITEM_ORD_NO$ TO 9
|
|
EQU COMM_INOVICE_ITEM_ORD_ITEM$ TO 10
|
|
EQU COMM_INVOICE_ITEM_QTY$ TO 11
|
|
EQU COMM_INVOICE_ITEM_DESC$ TO 12
|
|
EQU COMM_INVOICE_ITEM_PRICE$ TO 13
|
|
EQU COMM_INVOICE_ITEM_EXT_AMT$ TO 14
|
|
EQU COMM_INVOICE_SUB_SUPPLIED_BY$ TO 15
|
|
EQU COMM_INVOICE_INCO_CODE$ TO 16
|
|
|
|
EQU PI$LEFT TO 1
|
|
EQU PI$TOP TO 2
|
|
EQU PI$RIGHT TO 3
|
|
EQU PI$BOTTOM TO 4
|
|
EQU PI$WIDTH TO 5
|
|
EQU PI$HEIGHT TO 6
|
|
EQU PI$SIZE TO 7
|
|
|
|
EQU LTGREY$ TO 229 + (229*256) + (229*65536)
|
|
|
|
|
|
IF NOT(ASSIGNED(ShipNo)) THEN ShipNo = ''
|
|
IF NOT(ASSIGNED(PrintPath)) THEN PrintPath = ''
|
|
IF NOT(ASSIGNED(PDFFileName)) THEN PDFFileName = ''
|
|
IF NOT(ASSIGNED(PrinterInitialized)) THEN PrinterInitialized = 0
|
|
|
|
IF ShipNo = '' THEN
|
|
ErrMsg('Null parameter "ShipNo" passed to routine Print_Comm_Invoice')
|
|
RETURN
|
|
END
|
|
|
|
|
|
* * * PRINT SETUP * * *
|
|
|
|
|
|
FileName = 'Print Commercial Invoice'
|
|
Title = 'Print Commercial Invoice'
|
|
|
|
PageInfo = '' ; * Default is .5 inch margins and 8.5 x 11 paper
|
|
PageInfo<PI$LEFT> = 0.5
|
|
PageInfo<PI$TOP> = 1.5
|
|
PageInfo<PI$RIGHT> = 0.5
|
|
PageInfo<PI$BOTTOM> = 0.5
|
|
PageInfo<PI$SIZE> = LETTER
|
|
|
|
MaxPrintLength = 11 - PageInfo<PI$TOP> - PageInfo<PI$BOTTOM>
|
|
|
|
PageSetup = 0 ;* 1 = Landscape mode
|
|
PrintSetup = 0 ;* 0 = No Preview, 2 = Preview
|
|
|
|
|
|
|
|
IF NOT(PrinterInitialized) THEN
|
|
|
|
PrintSetup = ''
|
|
PrintSetup<1,1> = '2' ;* Specific Location
|
|
PrintSetup<1,2> = '5' ;* Show Print and PDF, hide Print Setup
|
|
PrintSetup<1,3> = '0' ;* Show the printing window
|
|
PDFParms = 'Printing PDF Document':@FM: '' :@FM:'':@FM: ''
|
|
|
|
stat = Set_Printer( 'INIT', PDFParms, 'Commercial Invoice',PageInfo,PageSetup , PrintSetup)
|
|
|
|
END ELSE
|
|
stat = Set_Printer('PAGEBREAK')
|
|
END
|
|
|
|
GOSUB PrintSheet
|
|
|
|
IF NOT(PrinterInitialized) THEN
|
|
stat = Set_Printer( 'TERM' )
|
|
END
|
|
|
|
RETURN
|
|
|
|
* * * * * *
|
|
PrintSheet:
|
|
* * * * * *
|
|
|
|
font = 'Arial' ;* Font basics
|
|
font<2> = 10
|
|
font<4> = 0
|
|
|
|
stat = Set_Printer('FONTHEADFOOT', font)
|
|
|
|
font = 'Arial'
|
|
font<2> = '18' ;* Big type
|
|
font<4> = 1 ;* Bold on
|
|
font<5> = 1 ;* Italics
|
|
|
|
stat = Set_Printer('TEXTXY','Commercial Invoice',2.20:@FM:-0.80,font,0)
|
|
|
|
font<2> = 12 ;* Drop the font size
|
|
font<5> = 0 ;* Italics off
|
|
|
|
IF NOT(PrinterInitialized) THEN
|
|
stat = Set_Printer('FOOTER',"Page 'P'":@VM:@VM:"'T' 'D'")
|
|
|
|
stat = Set_Printer('LINESTYLE', PS_SOLID:@FM:2)
|
|
stat = Set_Printer('LINE', -0.1:@FM:-1.2:@FM:7.5:@FM:-1.2, 1)
|
|
stat = Set_Printer('LINE', -0.1:@FM:-0.1:@FM:7.5:@FM:-0.1, 1)
|
|
|
|
location = -0.15:@fm:-1.150:@fm:1.57:@fm:1
|
|
stat = Set_Printer('BMP',obj_Install('Get_Prop','ColorBMP'),location, 0,1)
|
|
|
|
* * * * Added 10/8/2015 JCH - Updated 'CONFIG','COMPANY' * * * *
|
|
|
|
InstDat = obj_Install('Get_Prop','Company':@FM:'Division')
|
|
Company = InstDat<1>
|
|
Division = InstDat<2>
|
|
|
|
font = 'Arial'
|
|
font<2> = '12' ;* Big type
|
|
font<4> = 1 ;* Bold on
|
|
font<5> = 0 ;* Italics
|
|
|
|
stat = Set_Printer('TEXTXY',Company,5.7:@FM:-1.15,font,1)
|
|
stat = Set_Printer('TEXTXY',Division,5.7:@FM:-0.970,font,1)
|
|
|
|
font<2> = 10 ;* 10 point font
|
|
font<4> = 0 ;* Bold off
|
|
font<5> = 0 ;* Italics Off
|
|
|
|
stat = Set_Printer('TEXTXY',obj_Install('Get_Prop','Address'), 5.7:@fm:-0.775, font,1)
|
|
stat = Set_Printer('TEXTXY',obj_Install('Get_Prop','CSZC'), 5.7:@fm:-0.625, font,1)
|
|
stat = Set_Printer('TEXTXY','Tel: ':obj_Install('Get_Prop','Phone'), 5.7:@fm:-0.475, font, 1)
|
|
stat = Set_Printer('TEXTXY','FAX: ':obj_Install('Get_Prop','FAX'), 5.7:@fm:-0.325, font, 1)
|
|
|
|
* * * * End of changes 10/8/2015 JCH * * * *
|
|
|
|
stat = Set_Printer('TEXT')
|
|
|
|
END
|
|
|
|
colHeader = 'Tracking No(s)' ; colFormat = '^10800'
|
|
|
|
TrackingNos = XLATE('COC',ShipNo,COC_TRACKING_NOS$,'X')
|
|
SWAP ', ' WITH @VM IN TrackingNos
|
|
|
|
colData = TrackingNos
|
|
|
|
font<2> = 10
|
|
font<4> = 1 ;* Bold on
|
|
stat = Set_Printer('FONT',font)
|
|
stat = Set_Printer('ADDTABLE',colFormat,colHeader,'',LTGREY$,'',0,TB_ALL)
|
|
|
|
font<2> = 10
|
|
font<4> = 0
|
|
stat = Set_Printer('FONT',font)
|
|
|
|
stat = Set_Printer('ADDTABLE',colFormat,'',colData,LTGREY$,'',1,TB_ALL)
|
|
|
|
stat = Set_Printer('TEXT')
|
|
|
|
CommInvoiceData = obj_Invoice('CommInvoice',ShipNo)
|
|
|
|
ShipTo = CommInvoiceData<COMM_INVOICE_SHIP_TO$>
|
|
PhoneTypes = CommInvoiceData<COMM_INVOICE_PHONE_TYPE$>
|
|
PhoneNos = CommInvoiceData<COMM_INVOICE_PHONE_NO$>
|
|
|
|
SWAP @TM WITH CRLF$ IN ShipTo
|
|
SWAP @VM WITH CRLF$ IN PhoneTypes
|
|
SWAP @VM WITH CRLF$ IN PhoneNos
|
|
|
|
* * * *
|
|
|
|
colHeader = 'Consignee' ; colFormat = '<6840'
|
|
colHeader<1,2> = 'Phone' ; colFormat<1,2> = '<1980'
|
|
colHeader<1,3> = 'Number' ; colFormat<1,3> = '<1980'
|
|
|
|
colData = ShipTo
|
|
colData<1,2> = PhoneTypes
|
|
colData<1,3> = PhoneNos
|
|
|
|
font<2> = 10
|
|
font<4> = 1 ;* Bold on
|
|
stat = Set_Printer('FONT',font)
|
|
stat = Set_Printer('ADDTABLE',colFormat,colHeader,'',LTGREY$,'',0,TB_ALL)
|
|
|
|
font<2> = 10
|
|
font<4> = 0
|
|
stat = Set_Printer('FONT',font)
|
|
|
|
stat = Set_Printer('ADDTABLE',colFormat,'',colData,LTGREY$,'',1,TB_ALL)
|
|
|
|
stat = Set_Printer('TEXT')
|
|
|
|
* * * *
|
|
|
|
colHeader = 'Packing List No.' ; colFormat = '^2400'
|
|
colHeader<1,2> = 'Purchase Order No.' ; colFormat<1,2> = '^2400'
|
|
colHeader<1,3> = 'Timestamp' ; colFormat<1,3> = '^3600'
|
|
colHeader<1,4> = 'INCO Terms' ; colFormat<1,4> = '^2400'
|
|
|
|
colData = ShipNo
|
|
colData<1,2> = CommInvoiceData<COMM_INVOICE_PO$>
|
|
colData<1,3> = OCONV(Date(),'D4/'):' ':OCONV(Time(),'MTH')
|
|
colData<1,4> = CommInvoiceData<COMM_INVOICE_INCO_CODE$>
|
|
|
|
font<2> = 10
|
|
font<4> = 1 ;* Bold on
|
|
stat = Set_Printer('FONT',font)
|
|
stat = Set_Printer('ADDTABLE',colFormat,colHeader,'',LTGREY$,'',0,TB_ALL)
|
|
|
|
font<2> = 10
|
|
font<4> = 0
|
|
stat = Set_Printer('FONT',font)
|
|
|
|
stat = Set_Printer('ADDTABLE',colFormat,'',colData,LTGREY$,'',1,TB_ALL)
|
|
|
|
stat = Set_Printer('TEXT')
|
|
|
|
Country = CommInvoiceData<COMM_INVOICE_ORIGIN$>
|
|
|
|
SubSuppliedBy = CommInvoiceData<COMM_INVOICE_SUB_SUPPLIED_BY$>
|
|
|
|
colHeader = '' ; colFormat = '^10800'
|
|
|
|
BEGIN CASE
|
|
CASE SubSuppliedBy = 'C'
|
|
colData = 'Return of Goods Originating from ':Country
|
|
|
|
CASE SubSuppliedBy = 'L'
|
|
colData = 'Goods Originating from USA'
|
|
|
|
CASE 1
|
|
colData = 'Goods Originating from USA'
|
|
END CASE
|
|
|
|
BIfont = 'Arial'
|
|
BIfont<2> = '12' ;* Big type
|
|
BIfont<4> = 1 ;* Bold on
|
|
BIfont<5> = 1 ;* Italics
|
|
|
|
stat = Set_Printer('FONT',BIfont)
|
|
stat = Set_Printer('ADDTABLE',colFormat,'',colData,LTGREY$,'',1,TB_NONE)
|
|
stat = Set_Printer('TEXT')
|
|
|
|
stat = Set_Printer('FONT',font)
|
|
|
|
colHeader = 'Ord No' ; colFormat = '^720'
|
|
colHeader<1,2> = 'Item No' ; colFormat<1,2> = '^720'
|
|
colHeader<1,3> = 'Qty' ; colFormat<1,3> = '^1080'
|
|
colHeader<1,4> = 'Description' ; colFormat<1,4> = '<5760'
|
|
colHeader<1,5> = 'Unit':CRLF$:'Value' ; colFormat<1,5> = '>1080'
|
|
colHeader<1,6> = 'Subtotal' ; colFormat<1,6> = '>1440'
|
|
|
|
ItemOrdNos = CommInvoiceData<COMM_INVOICE_ITEM_ORD_NO$>
|
|
ItemNos = CommInvoiceData<COMM_INOVICE_ITEM_ORD_ITEM$>
|
|
ItemQtys = CommInvoiceData<COMM_INVOICE_ITEM_QTY$>
|
|
ItemDescs = CommInvoiceData<COMM_INVOICE_ITEM_DESC$>
|
|
ItemPrices = CommInvoiceData<COMM_INVOICE_ITEM_PRICE$>
|
|
ItemExtAmts = CommInvoiceData<COMM_INVOICE_ITEM_EXT_AMT$>
|
|
|
|
colData = ''
|
|
|
|
FOR I = 1 TO COUNT(ItemOrdNos,@VM) + (ItemOrdNos NE '')
|
|
colData<I,1> = ItemOrdNos<1,I>
|
|
colData<I,2> = ItemNos<1,I>
|
|
colData<I,3> = ItemQtys<1,I>
|
|
colData<I,4> = ItemDescs<1,I>
|
|
colData<I,5> = ItemPrices<1,I>
|
|
colData<I,6> = ItemExtAmts<1,I>
|
|
NEXT I
|
|
|
|
font<2> = 10
|
|
font<4> = 1 ;* Bold on
|
|
stat = Set_Printer('FONT',font)
|
|
stat = Set_Printer('ADDTABLE',colFormat,colHeader,'',LTGREY$,'',0,TB_ALL)
|
|
|
|
font<2> = 10
|
|
font<4> = 0
|
|
stat = Set_Printer('FONT',font)
|
|
|
|
stat = Set_Printer('ADDTABLE',colFormat,'',colData,LTGREY$,'',1,TB_ALL)
|
|
|
|
stat = Set_Printer('TEXT')
|
|
|
|
|
|
TotalValue = OCONV(SUM(ICONV(ItemExtAmts,'MD3')),'MD23,$'):' USD'
|
|
|
|
ShipRec = XLATE('COC',ShipNo,'','X')
|
|
|
|
TotBoxes = ShipRec<COC_TRACK_NO_BOX_CNT$>
|
|
ShipWt = ShipRec<COC_TRACK_NO_SHIP_WT$>
|
|
Shipper = ShipRec<COC_SHIP_VIA$>
|
|
|
|
|
|
colHeader = 'Total Boxes' ; colFormat = '^3600'
|
|
colHeader<1,2> = 'Total Weight' ; colFormat<1,2> = '^3600'
|
|
colHeader<1,3> = 'Total Value' ; colFormat<1,3> = '^3600'
|
|
|
|
|
|
colData = TotBoxes
|
|
colData<1,2> = ShipWt:'lbs / ':OCONV(ICONV((ShipWt*0.45),'MD2'),'MC2'):'kg'
|
|
colData<1,3> = TotalValue
|
|
|
|
|
|
font<2> = 10
|
|
font<4> = 1 ;* Bold on
|
|
stat = Set_Printer('FONT',font)
|
|
stat = Set_Printer('ADDTABLE',colFormat,colHeader,'',LTGREY$,'',0,TB_ALL)
|
|
|
|
font<2> = 10
|
|
font<4> = 0
|
|
stat = Set_Printer('FONT',font)
|
|
|
|
stat = Set_Printer('ADDTABLE',colFormat,'',colData,LTGREY$,'',1,TB_ALL)
|
|
|
|
stat = Set_Printer('TEXT')
|
|
|
|
|
|
|
|
Blurb = "{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}}"
|
|
Blurb := "{\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\f0\fs20\par "
|
|
|
|
Blurb := "These commodities were exported from the United States in accordance with the Export Administration regulations.\par "
|
|
Blurb := "Diversion contrary to U.S. law prohibited. NLR \par\par "
|
|
Blurb := "I/We do hereby authorize\b ":Shipper:"\b0 to execute any additional documents necessary for the export of "
|
|
Blurb := "merchandise described herein on my/our behalf.\par\par "
|
|
Blurb := '\b"Value is for customs purposes only."\b0 \par\par '
|
|
Blurb := "I/We declare all the information contained in this invoice to be true and correct. \par "
|
|
Blurb := "}"
|
|
|
|
stat = Set_Printer('TEXTRTF',Blurb)
|
|
|
|
|
|
stat = Set_Printer('TEXT')
|
|
stat = Set_Printer('TEXT')
|
|
stat = Set_Printer('TEXT')
|
|
stat = Set_Printer('TEXT')
|
|
|
|
Signature = STR('_',40)
|
|
|
|
stat = Set_Printer('TEXT',Signature)
|
|
stat = Set_Printer('TEXT')
|
|
stat = Set_Printer('TEXT')
|
|
stat = Set_Printer('TEXT','Shipping/Receiving Signature')
|
|
*stat = Set_Printer('TEXT',OCONV(Date(),'D4/'):' ':OCONV(Time(),'MTH'))
|
|
|
|
|
|
RETURN
|
|
|
|
|
|
|
|
|
|
|