Your SlideShare is downloading. ×
0
Baksik3 enug baksik_xmlinvoice
Baksik3 enug baksik_xmlinvoice
Baksik3 enug baksik_xmlinvoice
Baksik3 enug baksik_xmlinvoice
Baksik3 enug baksik_xmlinvoice
Baksik3 enug baksik_xmlinvoice
Baksik3 enug baksik_xmlinvoice
Baksik3 enug baksik_xmlinvoice
Baksik3 enug baksik_xmlinvoice
Baksik3 enug baksik_xmlinvoice
Baksik3 enug baksik_xmlinvoice
Baksik3 enug baksik_xmlinvoice
Baksik3 enug baksik_xmlinvoice
Baksik3 enug baksik_xmlinvoice
Baksik3 enug baksik_xmlinvoice
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Baksik3 enug baksik_xmlinvoice

270

Published on

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
270
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Creating and loading XMLinvoices by Corinna Baksik Programming by: Tim Elliot
  • 2. Why?• Many vendors can’t supply EDI invoices• This is an alternate way of getting the invoices into Aleph• Loading an invoice with line items means staff doesn’t have to do as much data entry
  • 3. PremiseLeverage Aleph’s 2-step EDI process:Step 1, p-edi-09: convert EDI to internal XML formatStep 2, p-edi-10: load XML into Aleph
  • 4. We can skipedi-09, andcreate theXML in theformat Alephneeds asinput for edi-10
  • 5. Pre-conditions• We are loading vendor MARC records + Order Records• MARC records contain data that can be used to create an invoice: Price Invoice # Date Vendor Ref #
  • 6. Importance of Vendor Ref #• When an EDI invoice is loaded, Aleph compares PO# in invoice to PO# in system• In absence of Aleph PO#, system uses Vendor Ref # as the secondary match point
  • 7. Load MARC record + Order RecordOrder Record in Aleph, loaded with file-90 Mapped from vendor MARC record
  • 8. MARC to XMLFMT L BKLDR L ^^^^^nam^a22002057a^4500008 L 110411s2010^^^^bl^^^^^^^^^^^^000^0^por^d020 L $$a9788574783413040 L $$aAR-BaFGC$$cAR-BaFGC1001 L $$aGrin, Monica.24510 L $$aRaca :$$bdebate publico no Brasil, 1997-2007 /$$cMonica Grin.260 L $$aRio de Janeiro, RJ :$$bMauad X :$$bFAPERJ,$$c2010.300 L $$a220 p. ;$$c23 cm.980 L $$a111017$$b3770$$e4112$$g1$$fgar1-161256/0$$y817$$z20111017981 L $$b415.37880..565103.655000.0000.00000-2012049 L $$aGARWIDAMA
  • 9. Perl script creates XML invoice Scripting by Tim Elliot, Harvard Librarywhile (<FILE>) { # Find any 980 tags with the invoice information if (/ 980 L .+$$b(.+)$$e.+$$g(d+)$$f(S+)$$y(S+)$$z(d{8})/) { # Save invoice info in an array in a hash. Use the invoice number # with a count as a hash key. We can easily sort on that. $invoice_count++; my $hash_key = $4 . - . sprintf("%06d", $invoice_count); $invoices{$hash_key} = [ $1, $2, $3, $4, $5 ]; } }
  • 10. $xmlWriter = new XML::Writer(OUTPUT => $xml_invoice,• Script uses Perl DATA_MODE => 1, DATA_INDENT => 2); extension $xmlWriter->xmlDecl(); $xmlWriter->startTag(message); xmlWriter $xmlWriter->dataElement(vendor-code, $acq_code); # Sort %invoices on its hash keys, this will group invoices foreach $key (sort keys %invoices) {• Reads through my $price = $invoices{$key}[0]; my $quantity = $invoices{$key}[1]; 980 tags for my my $vendor_ref_number $invoice_number = = $invoices{$key}[2]; $invoices{$key}[3]; element values my $date = $invoices{$key}[4]; # Remove white space or commas from price field $price =~ s/[ ,]//;• Have to account # Also, make sure it contains a decimal point if ($price =~ /^(d*)(dd)$/) { for variability in $price = $1 . . . $2; } the way vendor if ($prior_invoice_number) { submits price if ($prior_invoice_number eq $invoice_number) { $line_number++; } else { finishInvoice($line_number); startInvoice($invoice_number, $date); $line_number = 1; } } else { startInvoice($invoice_number, $date); $line_number = 1; }
  • 11. • Write values $xmlWriter->startTag(item); $xmlWriter->dataElement(line-number, $line_number); for invoice line $xmlWriter->dataElement(invoiced-quantity, $quantity); $xmlWriter->dataElement(amount, $price); items $xmlWriter->dataElement(price, $price); $xmlWriter->dataElement(vendor-reference-no, $vendor_ref_number); $xmlWriter->dataElement(total-line-amount, $price); $xmlWriter->endTag(item); $prior_invoice_number = $invoice_number; } close FILE; # Finish final invoice and the xml invoice file finishInvoice($line_number); $xmlwRITER->ENDtAG(MESSAGE); $xmlWriter->end(); $xml_invoice->close(); return 1;
  • 12. Load Invoice, edi-10XML Invoice item Order Record There is no PO# in the invoice, so when p-edi-10 (load invoice) is run, it uses Vendor Ref # as a match point to find Order Record
  • 13. Order Record Invoice Invoice
  • 14. Transactions appear in EDI Load Log as if this had been a normal EDI invoice
  • 15. Questions?Corinna BaksikSystems Librarian, Office for Information SystemsHarvard LibraryEmail: corinna_baksik@harvard.eduSkype: corinna_baksik

×