Skip to main content

Get-Invoice-Type

Command Description

Get invoice type of invoice OCR

Command Prototype

sRet = Mage.ExtractInvoiceType(value)

Parameter Description

ParameterRequiredTypeDefaultDescription
valueTrueexpressionvalueUse commands such as "Screen Invoice OCR", "Image Invoice OCR", "PDF Invoice OCR" to output variables and loop through their values

return

sRet,The variable used to save the output of the command.

Demo

Dim value = {"ai_function" : "ocr_invoice","class" : 3,"goods" : [],"image_angle" : 0,"items" : [{"description" : "火车票红色编码","key" : "ticket_number","positions" : [{"x" : 46,"y" : 25},{"x" : 195,"y" : 25},{"x" : 195,"y" : 59},{"x" : 46,"y" : 59}],"value" : "H014366"},{"description" : "检票口","key" : "boarding_gate","positions" : [{"x" : 0,"y" : 0},{"x" : 0,"y" : 0},{"x" : 0,"y" : 0},{"x" : 0,"y" : 0}],"value" : ""},{"description" : "检票口","key" : "check","positions" : [{"x" : 0,"y" : 0},{"x" : 0,"y" : 0},{"x" : 0,"y" : 0},{"x" : 0,"y" : 0}],"value" : ""},{"description" : "出发地","key" : "departure_station","positions" : [{"x" : 70,"y" : 67},{"x" : 203,"y" : 67},{"x" : 203,"y" : 108},{"x" : 70,"y" : 108}],"value" : "北京北站"},{"description" : "车次号","key" : "train_number","positions" : [{"x" : 257,"y" : 74},{"x" : 374,"y" : 74},{"x" : 374,"y" : 109},{"x" : 257,"y" : 109}],"value" : "G9103"},{"description" : "目的地","key" : "arrival_station","positions" : [{"x" : 391,"y" : 67},{"x" : 523,"y" : 67},{"x" : 523,"y" : 108},{"x" : 391,"y" : 108}],"value" : "张家口站"},{"description" : "乘车时间","key" : "departure_date","positions" : [{"x" : 49,"y" : 133},{"x" : 343,"y" : 133},{"x" : 343,"y" : 165},{"x" : 49,"y" : 165}],"value" : "2019-12-30 17:53"},{"description" : "座位号","key" : "seat_number","positions" : [{"x" : 382,"y" : 135},{"x" : 505,"y" : 135},{"x" : 505,"y" : 164},{"x" : 382,"y" : 164}],"value" : "05车06C号"},{"description" : "价格","key" : "price","positions" : [{"x" : 82,"y" : 173},{"x" : 151,"y" : 172},{"x" : 151,"y" : 195},{"x" : 82,"y" : 195}],"value" : "110.0"},{"description" : "座位类别","key" : "class","positions" : [{"x" : 426,"y" : 167},{"x" : 531,"y" : 167},{"x" : 531,"y" : 196},{"x" : 426,"y" : 196}],"value" : "多功能座"},{"description" : "乘客身份证","key" : "passenger_id","positions" : [{"x" : 51,"y" : 260},{"x" : 398,"y" : 260},{"x" : 398,"y" : 293},{"x" : 51,"y" : 293}],"value" : "4330261954****0012"},{"description" : "乘客名称","key" : "passenger_name","positions" : [{"x" : 51,"y" : 260},{"x" : 398,"y" : 260},{"x" : 398,"y" : 293},{"x" : 51,"y" : 293}],"value" : "刘建华"},{"description" : "火车票ID","key" : "ticket_id","positions" : [{"x" : 57,"y" : 360},{"x" : 399,"y" : 360},{"x" : 399,"y" : 389},{"x" : 57,"y" : 389}],"value" : "65678301011231H014366"},{"description" : "发票代码","key" : "code","positions" : [{"x" : 57,"y" : 360},{"x" : 399,"y" : 360},{"x" : 399,"y" : 389},{"x" : 57,"y" : 389}],"value" : "65678301011231"},{"description" : "火车票红色编码","key" : "number","positions" : [{"x" : 57,"y" : 360},{"x" : 399,"y" : 360},{"x" : 399,"y" : 389},{"x" : 57,"y" : 389}],"value" : "H014366"}],"kind" : 2,"page_number" : 1,"rotated_image_height" : 408,"rotated_image_width" : 632,"type" : 20,"type_description" : "火车票","type_key" : "train_ticket"}  // Test数据 

TracePrint "--------------------Get ticket type--------------------"
// --------------------------------------------------------
// [Remarks] Get the ticket type
// Input parameters:
// value--Ticket recognition result

// Output parameters:
// sRet--The variable to which the output of the function call is saved

// Command prototype: sRet = Mage.ExtractInvoiceType(value)
// --------------------------------------------------------

sRet = Mage.ExtractInvoiceType (value)
Traceprint (sRet)