senaidbp Posted April 8, 2014 Posted April 8, 2014 Hi, I have optical store and I made Filemaker database to manage inventory of optical frames and lenses. Now I want to implement fiscal printer into same database so I can print receipts directly. Fiscal printer read xml files but files needs to be in some particular format, Filemaker does not export it that way. So I will attach two files, One is example of what it should look like to be readable by printer and the other one is example of how file maker export it from my database. This is sample what is what: DATA BCR= Sifra Proizvoda VAT= PDV stopa PRC= MPC AMN= Kolicina Could someone help me write xslt file so I can export it the right way??? Thank you RCP_104300.XMLUntitled.xml
comment Posted April 8, 2014 Posted April 8, 2014 Try: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fmp="http://www.filemaker.com/fmpxmlresult" exclude-result-prefixes="fmp"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/"> <RECEIPT> <xsl:for-each select="fmp:FMPXMLRESULT/fmp:RESULTSET/fmp:ROW"> <DATA BCR='{fmp:COL[1]/fmp:DATA}' VAT='{fmp:COL[2]/fmp:DATA}' PRC='{fmp:COL[3]/fmp:DATA}' AMN='{fmp:COL[4]/fmp:DATA}'/> </xsl:for-each> </RECEIPT> </xsl:template> </xsl:stylesheet> 1
senaidbp Posted April 9, 2014 Author Posted April 9, 2014 This definitely helps. I can not test it out right now with printer, but soon I will. Thank you very much.
senaidbp Posted April 24, 2015 Author Posted April 24, 2015 I have tested it and it works excellent. But now I have other issue by default printer total amount as cash. Sometimes I need to use money transfer or Credit Card. I made three fields for amounts of Credit Card, Money transfer and cash which is different table from my products table from above. Below is how final example should looks like. DATA AMN after products is amount of money and PAY= 0 or 1 or 2 is code for cash, money transfer or credit card. If you could help me it will be appreciated? Thank you <?xml version="1.0" encoding="UTF-8"?> <RECEIPT> <DATA BCR="315" VAT="1" MES="0" DEP="0" DSC="CR" PRC="7.50" AMN="2"/> <DATA BCR="316" VAT="1" MES="0" DEP="0" DSC="CR" PRC="77.50" AMN="2"/><DATA BCR="317" VAT="1" MES="0" DEP="0" DSC="CR" PRC="777.50" AMN="2"/><DATA AMN="30.50" PAY="0"/><DATA AMN="10" PAY="1"/><DATA AMN="5000" PAY="2"/></RECEIPT>
comment Posted April 24, 2015 Posted April 24, 2015 I made three fields for amounts of Credit Card, Money transfer and cash which is different table from my products table from above. I am afraid that's not clear enough. Is the data required to populate the three <DATA AMN="@@@" PAY="X"/> elements present in the export? If so, where is it?
senaidbp Posted April 24, 2015 Author Posted April 24, 2015 DATA BCR="317" VAT="1" MES="0" DEP="0" DSC="CR" PRC="777.50" AMN="2" this is exported from one table, and this is working good I want to add DATA AMN="@@@" PAY="X"/ elements from other table at the end of as shown in example above. This is part where I need help. It should export amount of cash instead od "@@@" and 1 instead of "X" , Amount for Credit Card in next row instead of "@@@" and 2 instead of "X" etc etc
comment Posted April 24, 2015 Posted April 24, 2015 1. You're not answering my question. I don't know how you can get the result you're looking for, because I don't understand what you're starting with. 2. I suspect you are making this more complicated than it needs to be. If you are exporting records that have an amount and a type, you can tell the stylesheet to summarize the amounts by type at the end (this is assuming you want to summarize the amounts by type - in your example above the totals do not add up).
senaidbp Posted April 24, 2015 Author Posted April 24, 2015 Table A conatins: 1.Patient details(name, birth date, phone etc...) 2. Portal related to Table B (which contains products like : lens, optical frame...) 3. Thee fields Called: 1.Cash, 2.Money Transfer, 3. Credit Card with first stylesheet you helped me to export product details like this(<DATA BCR="315" VAT="1" MES="0" DEP="0" DSC="CR" PRC="7.50" AMN="2"/>) when it is exported to specific folder fiscal printer print receipt, by default receipt is always payed in cash. If I add DATA AMN="@@@" PAY="X" after list of products I can specify type of payment this is everything should be exported as one XML file from Filemaker. So if I have patient who spent $100 (for frame $60 and for lens $20x2=$40)and he want to pay in cash=$20, Credit card=$50 and money transfer=$30 this is how xml file should look like: <?xml version="1.0" encoding="UTF-8"?> <RECEIPT> <DATA BCR="315" VAT="1" MES="0" DEP="0" DSC="LENS" PRC="20.00" AMN="2"/> <DATA BCR="316" VAT="1" MES="0" DEP="0" DSC="FRAME" PRC="60.00" AMN="1"/><DATA AMN="20" PAY="0"/><DATA AMN="50" PAY="1"/><DATA AMN="30" PAY="2"/></RECEIPT>
comment Posted April 24, 2015 Posted April 24, 2015 (edited) Okay, so which table are you exporting from? Hopefully, it's the one you call "TableB" - with the 3 fields from the parent table included in the export? Edited April 24, 2015 by comment
senaidbp Posted April 24, 2015 Author Posted April 24, 2015 Records from both table should be included in one xml file. This is what I get from Table B <DATA BCR="315" VAT="1" MES="0" DEP="0" DSC="LENS" PRC="20.00" AMN="2"/> <DATA BCR="316" VAT="1" MES="0" DEP="0" DSC="FRAME" PRC="60.00" AMN="1"/> and this from Table A (should get) <DATA AMN="20" PAY="0"/><DATA AMN="50" PAY="1"/><DATA AMN="30" PAY="2"/>
comment Posted April 24, 2015 Posted April 24, 2015 Â Â Records from both table should be included in one xml file. âYes, I understand that - but you can export from only one table. You can include fields from related tables, but exporting from the parent table with child fields included is not the same thing as exporting from the child table with the parent fields included. So, assuming you are exporting from a layout of the child table, and your export field order looks something like this: Note there are 4 child fields and 3 parent fields exported. Their order matters. If you export in this manner, you can use the following stylesheet to format the export: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fmp="http://www.filemaker.com/fmpxmlresult" exclude-result-prefixes="fmp"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/"> <RECEIPT> <xsl:for-each select="fmp:FMPXMLRESULT/fmp:RESULTSET/fmp:ROW"> <DATA BCR="{fmp:COL[1]/fmp:DATA}" VAT="1" MES="0" DEP="0" DSC="{fmp:COL[2]/fmp:DATA}" PRC="{fmp:COL[3]/fmp:DATA}" AMN="{fmp:COL[4]/fmp:DATA}"/> </xsl:for-each> <xsl:for-each select="fmp:FMPXMLRESULT/fmp:RESULTSET/fmp:ROW[1]"> <DATA AMN="{fmp:COL[5]/fmp:DATA}" PAY="0"/> <DATA AMN="{fmp:COL[6]/fmp:DATA}" PAY="1"/> <DATA AMN="{fmp:COL[7]/fmp:DATA}" PAY="2"/> </xsl:for-each> </RECEIPT> </xsl:template> </xsl:stylesheet> Â 1
senaidbp Posted April 24, 2015 Author Posted April 24, 2015 This looks good. I can not test it now I will post results very soon.
Recommended Posts
This topic is 3764 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now