Starting with Saleculator version 4.3, users have the ability to customize the A4 invoice format. Saleculator utilizes JRXML for report design, allowing for easy customization of report formats using Jasper Studio.
To view and print your customized invoice in Saleculator, go to the ‘Edit Sales’ screen and click on the ‘Invoice’ button.
Steps:
Create a new resource Printer.Invoice and copy paste below code.
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.20.6.final using JasperReports Library version 6.20.6-5c96b6aa8a39ac1dc6b6bea4b81168e16dd39231 -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Invoice" pageWidth="595" pageHeight="842" columnWidth="535" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="4eedbb89-b4f6-4469-9ab6-f642a1688cf7">
<property name="ireport.scriptlethandling" value="0"/>
<property name="ireport.encoding" value="UTF-8"/>
<import value="net.sf.jasperreports.engine.*"/>
<import value="java.util.*"/>
<import value="net.sf.jasperreports.engine.data.*"/>
<parameter name="SUBREPORT_DIR" class="java.lang.String">
<defaultValueExpression><![CDATA["./"]]></defaultValueExpression>
</parameter>
<parameter name="INVOICELINES" class="net.sf.jasperreports.engine.JasperReport" isForPrompting="false"/>
<field name="TICKET" class="com.posics.pos.ticket.TicketInfo"/>
<field name="PLACE" class="java.lang.String"/>
<field name="TAXESLOGIC" class="java.lang.Object"/>
<field name="INVOICELINES" class="java.lang.String"/>
<title>
<band height="196" splitType="Stretch">
<staticText>
<reportElement x="0" y="109" width="84" height="21" uuid="57aed2b1-4f4e-40a3-a6ad-54dae8dd4c5a">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement>
<font fontName="Tahoma" size="10" isBold="true"/>
</textElement>
<text><![CDATA[Customer:]]></text>
</staticText>
<line>
<reportElement x="0" y="99" width="556" height="1" uuid="806ce5df-1219-4876-ae0c-ca7405b1f246">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
</line>
<staticText>
<reportElement x="415" y="10" width="50" height="20" uuid="0f86baff-6386-4f3f-b3fe-2388707babe8"/>
<box rightPadding="4"/>
<textElement textAlignment="Right">
<font fontName="Tahoma"/>
</textElement>
<text><![CDATA[Date:]]></text>
</staticText>
<textField pattern="EEEEE dd MMMMM yyyy">
<reportElement x="465" y="10" width="70" height="20" uuid="bb10dbe1-0a4f-4722-9953-c163b63cf979"/>
<textElement>
<font fontName="Tahoma" size="10" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{TICKET}.printDate()]]></textFieldExpression>
</textField>
<image hAlign="Center">
<reportElement x="0" y="0" width="65" height="60" uuid="94883631-a913-43e2-b182-ab8d77d0181e"/>
<imageExpression><![CDATA[com.posics.data.loader.ImageUtils.readImageFromResource("/com/posics/images/logo.png")]]></imageExpression>
</image>
<textField pattern="EEEEE dd MMMMM yyyy">
<reportElement x="465" y="30" width="74" height="20" uuid="3836ce65-eca3-4cad-a6de-b1818def0a2b"/>
<textElement>
<font fontName="Tahoma" size="10" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{TICKET}.printId()]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="415" y="30" width="50" height="20" uuid="0b3f9342-da78-4cfa-9fc5-2301c4749678"/>
<box rightPadding="4"/>
<textElement textAlignment="Right">
<font fontName="Tahoma"/>
</textElement>
<text><![CDATA[Invoice:]]></text>
</staticText>
<staticText>
<reportElement x="95" y="0" width="210" height="25" uuid="e622555d-198b-4ccd-a4a1-c59c53304058">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font fontName="Tahoma" size="18"/>
</textElement>
<text><![CDATA[Company Name]]></text>
</staticText>
<staticText>
<reportElement x="95" y="55" width="205" height="15" uuid="b8cc42fd-b569-497d-834d-7e854040ad18"/>
<textElement>
<font fontName="Tahoma"/>
</textElement>
<text><![CDATA[Phone number, web address, ecc.]]></text>
</staticText>
<staticText>
<reportElement x="95" y="25" width="205" height="15" uuid="c226e44d-3bb5-4145-b0b3-903bf1d79fde"/>
<textElement>
<font fontName="Tahoma"/>
</textElement>
<text><![CDATA[Street address]]></text>
</staticText>
<staticText>
<reportElement x="95" y="40" width="205" height="15" uuid="b96f7183-44f8-43ad-ba60-43d8fbf50b6e"/>
<textElement>
<font fontName="Tahoma"/>
</textElement>
<text><![CDATA[City, street, ZIP code]]></text>
</staticText>
<staticText>
<reportElement x="0" y="78" width="556" height="25" uuid="d67b368a-45a2-4c9a-b8da-fe5860ec8c51">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement textAlignment="Center">
<font fontName="Tahoma" size="14" isBold="true"/>
</textElement>
<text><![CDATA[TAX INVOICE]]></text>
</staticText>
<textField isBlankWhenNull="true">
<reportElement x="20" y="130" width="260" height="14" uuid="81f138ee-24b9-4a8f-8c78-a13d49130399"/>
<textElement>
<font fontName="Tahoma" size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{TICKET}.getCustomer().getName()]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="20" y="146" width="260" height="15" uuid="8b4e7282-3bab-4c8a-a7d2-77f123a33d81"/>
<textElement>
<font fontName="Tahoma" size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{TICKET}.getCustomer().getTaxid()]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="20" y="161" width="260" height="15" uuid="65c43f3e-7fb8-499d-902f-f2bd59857a73"/>
<textElement>
<font fontName="Tahoma" size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{TICKET}.getCustomer().getAddress()]]></textFieldExpression>
</textField>
</band>
</title>
<detail>
<band height="472" splitType="Stretch">
<subreport isUsingCache="true">
<reportElement key="subreport-1" stretchType="ElementGroupHeight" x="0" y="0" width="556" height="250" uuid="5e472894-a7d2-4200-bc4d-3273af7b0589"/>
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource(
$F{TICKET}.getLines()
)]]></dataSourceExpression>
<subreportExpression><![CDATA[$P{INVOICELINES}]]></subreportExpression>
</subreport>
<line>
<reportElement stretchType="ElementGroupHeight" x="285" y="20" width="1" height="401" uuid="7fb17339-2a39-44a0-ba4a-2e87417d3e6b">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
</line>
<line>
<reportElement stretchType="ElementGroupHeight" x="385" y="20" width="1" height="329" uuid="180f393d-95ed-499b-a6ad-4d9ffeeaf077">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
</line>
<line>
<reportElement stretchType="ElementGroupHeight" x="0" y="40" width="556" height="1" uuid="e4153e12-39e9-4902-a10f-b706aafcb1f9">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
</line>
<line>
<reportElement stretchType="ElementGroupHeight" x="-1" y="349" width="556" height="1" uuid="b9b73fc5-4384-4e3c-984d-4121d9874a39">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
</line>
<textField isBlankWhenNull="false">
<reportElement key="textField-8" x="454" y="362" width="101" height="19" uuid="1e5b1479-2270-4abb-b2f0-7b286fd68e43"/>
<box rightPadding="5"/>
<textElement textAlignment="Right">
<font fontName="Tahoma" size="10" isBold="false" pdfFontName="Helvetica-Bold"/>
</textElement>
<textFieldExpression><![CDATA[$F{TICKET}.printSubTotal()]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="false">
<reportElement key="textField-7" mode="Opaque" x="450" y="403" width="105" height="19" backcolor="#F0F0F0" uuid="90bc6258-aabc-4636-ada9-18aee63f6c3a"/>
<box rightPadding="5"/>
<textElement textAlignment="Right">
<font fontName="Tahoma" size="12" isBold="true" pdfFontName="Helvetica-Bold"/>
</textElement>
<textFieldExpression><![CDATA[$F{TICKET}.printTotal()]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="false">
<reportElement key="textField-6" x="454" y="381" width="101" height="19" uuid="6b534361-d25f-4bba-af45-083736600d1b"/>
<box rightPadding="5"/>
<textElement textAlignment="Right">
<font fontName="Tahoma" size="10" isBold="false" pdfFontName="Helvetica-Bold"/>
</textElement>
<textFieldExpression><![CDATA[$F{TICKET}.printTax()]]></textFieldExpression>
</textField>
<staticText>
<reportElement key="staticText-6" x="286" y="362" width="164" height="19" uuid="1ff47982-b123-4914-9671-ae1b51962e68"/>
<box rightPadding="10"/>
<textElement textAlignment="Right">
<font fontName="Tahoma" size="10" isBold="false" pdfFontName="Helvetica-Bold"/>
</textElement>
<text><![CDATA[Subtotal]]></text>
</staticText>
<staticText>
<reportElement key="staticText-9" mode="Opaque" x="286" y="403" width="164" height="19" backcolor="#F0F0F0" uuid="f0a92a54-73a0-4f3d-beb6-ca4d757390a2"/>
<box rightPadding="10"/>
<textElement textAlignment="Right">
<font fontName="Tahoma" size="12" isBold="true" pdfFontName="Helvetica-Bold"/>
</textElement>
<text><![CDATA[Total]]></text>
</staticText>
<staticText>
<reportElement key="staticText-8" x="286" y="382" width="164" height="19" uuid="384b935a-4975-4007-8e4e-c813733c57fc"/>
<box rightPadding="10"/>
<textElement textAlignment="Right">
<font fontName="Tahoma" size="10" isBold="false" pdfFontName="Helvetica-Bold"/>
</textElement>
<text><![CDATA[Taxes]]></text>
</staticText>
<line>
<reportElement stretchType="ElementGroupHeight" x="450" y="20" width="1" height="402" uuid="affe6d16-8ce5-43b7-9594-128dd74c001b">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
</line>
<image>
<reportElement x="60" y="360" width="100" height="100" uuid="0ef2f2c3-5685-479d-a3ad-d193e85dfa18"/>
<imageExpression><![CDATA[com.posics.data.loader.ImageUtils.readImage(
com.posics.pos.util.QRCodeGenerator.generateQRCode(
com.posics.pos.util.StringUtils.getZatcaQR(
"\nSaleculator POS\n0123456789\n"+$F{TICKET}.printDateFormatted("yyyy-MM-dd'T'HH:mm:ss'.000Z'")+"\n"+$F{TICKET}.printTotal()+"\n"+$F{TICKET}.printTax()
), 100, 100))]]></imageExpression>
</image>
</band>
</detail>
<lastPageFooter>
<band height="35">
<staticText>
<reportElement positionType="Float" mode="Opaque" x="285" y="0" width="270" height="30" uuid="36aa233d-4305-48e6-974a-1bbf89bb3c8f"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="Tahoma" size="10" isItalic="false"/>
</textElement>
<text><![CDATA[Authorised Signatory]]></text>
</staticText>
<line>
<reportElement x="295" y="0" width="260" height="1" uuid="337d0b59-964a-44ff-a94a-d78b7b6c24f0">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
</line>
</band>
</lastPageFooter>
</jasperReport>
Create a new resource Printer.InvoiceLines and copy paste below code.
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.20.6.final using JasperReports Library version 6.20.6-5c96b6aa8a39ac1dc6b6bea4b81168e16dd39231 -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="InvoiceReport" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="e5603ddd-3674-4808-a945-00b414e8e32d">
<style name="TableHeader" fontName="Arial" fontSize="12" isBold="true" isItalic="false"/>
<style name="TableData" fontName="Arial" fontSize="10" isBold="false" isItalic="false"/>
<field name="productName" class="java.lang.String"/>
<field name="_THIS" class="com.posics.pos.ticket.TicketLineInfo"/>
<columnHeader>
<band height="27">
<staticText>
<reportElement style="TableHeader" mode="Opaque" x="-19" y="0" width="280" height="20" backcolor="#F0F0F0" uuid="4a2493e3-b94e-4532-9a4d-2b33cf1f5eeb"/>
<box topPadding="3" leftPadding="5"/>
<textElement>
<font fontName="Tahoma" size="10"/>
</textElement>
<text><![CDATA[Item Name]]></text>
</staticText>
<staticText>
<reportElement style="TableHeader" mode="Opaque" x="261" y="1" width="100" height="20" backcolor="#F0F0F0" uuid="f57269f3-8824-4979-b8a3-c92cbe2c7f56"/>
<box topPadding="3" rightPadding="5"/>
<textElement textAlignment="Right">
<font fontName="Tahoma" size="10"/>
</textElement>
<text><![CDATA[Price]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="361" y="1" width="70" height="20" backcolor="#F0F0F0" uuid="9c267e5a-c3ef-4b55-8821-02809727d7b5"/>
<box topPadding="3" rightPadding="5"/>
<textElement textAlignment="Right">
<font fontName="Tahoma" size="10" isBold="true"/>
</textElement>
<text><![CDATA[Quantity]]></text>
</staticText>
<staticText>
<reportElement style="TableHeader" mode="Opaque" x="431" y="0" width="105" height="20" backcolor="#F0F0F0" uuid="38df47b7-1f26-4d0b-9e1e-8f7d5d21f4a7"/>
<box topPadding="3" rightPadding="5"/>
<textElement textAlignment="Right">
<font fontName="Tahoma" size="10"/>
</textElement>
<text><![CDATA[Total]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="20">
<textField>
<reportElement style="TableData" x="-19" y="0" width="350" height="20" uuid="c06d0a86-99d6-4420-a1fb-95ac57fc1654"/>
<box leftPadding="5"/>
<textElement>
<font fontName="Tahoma"/>
</textElement>
<textFieldExpression><![CDATA[$V{COLUMN_COUNT}+". "+$F{productName}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00">
<reportElement style="TableData" x="261" y="0" width="100" height="20" uuid="1eb4a6e2-cd0d-4da3-a40b-23d3f4f51d6b"/>
<box rightPadding="5"/>
<textElement textAlignment="Right">
<font fontName="Tahoma"/>
</textElement>
<textFieldExpression><![CDATA[$F{_THIS}.printPrice()]]></textFieldExpression>
</textField>
<textField pattern="#,##0">
<reportElement style="TableData" x="361" y="0" width="70" height="20" uuid="3f34524c-d748-4761-8bb0-21b24e340f49"/>
<box rightPadding="5"/>
<textElement textAlignment="Right">
<font fontName="Tahoma"/>
</textElement>
<textFieldExpression><![CDATA[$F{_THIS}.printMultiply()]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00">
<reportElement style="TableData" x="431" y="0" width="105" height="20" uuid="a424f883-9b07-4f07-b3de-9b21b6463182"/>
<box rightPadding="5"/>
<textElement textAlignment="Right">
<font fontName="Tahoma"/>
</textElement>
<textFieldExpression><![CDATA[$F{_THIS}.printSubValue()]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>
Arabic Character Support in Saleculator
To ensure proper support for Arabic characters in Saleculator, launch the application using the following command:
java -Dfile.encoding=UTF-8 -jar c:\Saleculator\Saleculator.jar
When working with Arabic characters in Saleculator, make sure to use fonts that support Unicode.
To incorporate a specific font in JRXML use code like below:
<textElement textAlignment="Left" verticalAlignment="Middle">
<font fontName="Tahoma" size="20" />
</textElement>
<text><![CDATA[اسم الشركة]]></text>
Download Jasper report Designer community edition here:
https://community.jaspersoft.com/files/file/19-jaspersoft%C2%AE-studio-community-edition/
Leave a Reply