Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Creating a Purchase Order in XML
Message
De
10/06/2003 13:33:17
Joel Leach
Memorial Business Systems, Inc.
Tennessie, États-Unis
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Web Services
Divers
Thread ID:
00798079
Message ID:
00798497
Vues:
27
Hi Paul,

The new XMLAdapter class in VFP 8.0 is supposed to add some capabilities that might be of use to you. At the least, I think you could use CursorToXML() to build the order detail XML for you, and do the rest manually. Note that CursorToXML() will produce field/tag names in lower case, and the vendor's system may be case-sensitive. I've used StrTran() in that situation to fix the case.

>I need to add XML functionality to my application. I want to start by creating a purchase order via xml so my customers can send the PO elecronically to the vendor. I have a vendor that is willing to work with me as I develop this feature.
>
>The vendor sent me a sample xml document they receive from a client:
>
>
><?xml version="1.0" encoding="utf-8"?>
><PurchaseOrder>
>	<OrderHeader>
>		<POIssuedDate>20030318T193435</POIssuedDate>
>		<RequestedDeliveryDate>20030318T193435</RequestedDeliveryDate>
>		<OrderReference>
>			<AccountCode>
>				<Reference>
>					<RefNum>1212909801</RefNum> (our trading partner’s ID)
>				</Reference>
>			</AccountCode>
>			<BuyerRefNum>
>				<Reference>
>					<RefNum>Z78740</RefNum> (PO#)
>				</Reference>
>			</BuyerRefNum>
>		</OrderReference>
>		<OrderParty>
>			<SupplierParty>
>				<Party PartyID="18-710-1399"/> (our trade ID)
>				<NameAddress>
>					<Name1>Kaman Music Corporation</Name1>
>				</NameAddress>
>			</SupplierParty>
>			<ShipToParty>
>				<Party PartyID="2"/> (ID assigned to this location)
>				<NameAddress>
>                                <Identifier>
>                                <Ident>DROP SHIP</Ident>
>                                </Identifier>
>                                <Attention>Mike Smith</Attention>
>					<Name1>Mike’s Music</Name1>
>					<Address1>2114 Tech Drive</Address1>
>					<Address2/>
>					<City>South Bend</City>
>					<StateOrProvince>IN</StateOrProvince>
>					<PostalCode>46628</PostalCode>
>					<Country>United States</Country>
>				</NameAddress>
>			</ShipToParty>
>		</OrderParty>
>		<Payment>
>			<PaymentTerm>Other</PaymentTerm>
>			<PaymentTermOther>21</PaymentTermOther> (previously agreed upon terms – will discuss later)
>		</Payment>
>		<SpecialHandlingNote>4% FREIGHT ALLOWANCE  </SpecialHandlingNote>
>		<Transport>
>			<Carrier>Other</Carrier>
>			<CarrierOther>1</CarrierOther> (carrier code. Ex: 1 = UPS)
>		</Transport>
>	</OrderHeader>
>	<ListOfOrderDetail>
>		<OrderDetail>
>			<BaseItemDetail>
>				<LineItemNum>1</LineItemNum>
>				<BuyerPartNum>
>					<PartNum>
>						<PartID>17740</PartID> (your item id)
>					</PartNum>
>				</BuyerPartNum>
>				<ManufacturerPartNum>
>					<PartNum>
>						<Agency AgencyID="Other">UPC</Agency>
>						<PartID>00731201528238</PartID> (Item UPC code)
>					</PartNum>
>				</ManufacturerPartNum>
>				<BackOrderItem>Y</BackOrderItem>
>				<ItemDescription>LP LP637</ItemDescription>
>				<Quantity>
>					<Qty>3</Qty>
>				</Quantity>
>			</BaseItemDetail>
>			<BuyerExpectedUnitPrice>
>				<Price>
>					<UnitPrice Currency="USD">123.45</UnitPrice>
>				</Price>
>			</BuyerExpectedUnitPrice>
>		</OrderDetail>
>		<OrderDetail>
>			<BaseItemDetail>
>				<LineItemNum>2</LineItemNum>
>				<BuyerPartNum>
>					<PartNum>
>						<PartID>56600</PartID>
>					</PartNum>
>				</BuyerPartNum>
>				<ManufacturerPartNum>
>					<PartNum>
>						<Agency AgencyID="Other">UPC</Agency>
>						<PartID>00622537350054</PartID>
>					</PartNum>
>				</ManufacturerPartNum>
>				<BackOrderItem>Y</BackOrderItem>
>				<ItemDescription>Sabian 35005</ItemDescription>
>				<Quantity>
>					<Qty>1</Qty>
>				</Quantity>
>			</BaseItemDetail>
>			<BuyerExpectedUnitPrice>
>				<Price>
>					<UnitPrice Currency="USD">123.45</UnitPrice>
>				</Price>
>			</BuyerExpectedUnitPrice>
>		</OrderDetail>
>	</ListOfOrderDetail>
></PurchaseOrder>
>
>
>It seems to me their are 2 major components: OrderHeader and ListOfOrderDetail.
>
>With my purchase order program the info that would go into orderheader is on the form in text boxes (Po#, Date, Address info, etc) and the info that would go into listorderdetail would be in a cursor (the line items to be ordered).
>
>The Vendor also sent me a list of the minimum requirements...but I won't display them here unless it would help.
>
>Will I be able to produce a document like this with CursorToXml()?
>
>It seems to me I would need to put all of the info in the cursor. However if I include the vendor#, date, etc in the cursor then it will be repeated for every lineitem?
>
>Can you point me in the right direction?
>
>Thank you in advance
>
>Paul Acton
Joel Leach
Microsoft Certified Professional
Blog: http://www.joelleach.net
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform