Choosing the design
Pick a design with plantilla, including the 80 mm POS receipts, list the available designs from the catalog and track the style each document used.
The same document can come out with different designs. You request one with plantilla, next to the type:
{
"type": "factura",
"plantilla": "premium",
"data": { }
}
For the invoice there are seventeen: estandar —the default—, premium, destacada —a color band running edge to edge with the parties and the table mounted on it—, seven with the Premium structure in another color: moderna, clasica, minimalista, profesional, corporativa, serena and basica, and seven POS receipts. They all read the same data, so changing design means changing one word.
POS receipts
The receipts (tirillas) are the electronic sales invoice for the point-of-sale printer: an 80 mm wide roll, in a single strip as long as its content —it is not cut into pages, whether it has 3 items or 30— and printed in black only, with no colors or gray backgrounds —in some designs, with white text on black bands—, because they come out of a thermal printer.
They take the same body as any other invoice and say the same things, in one column: regime, numbering authorization, rate per line, totals, amount in words, payment, fields, legal notes, CUFE, QR, resolution and software manufacturer. The sideNotes text goes at the end, in upright lines, because a roll has no margin. The logo is drawn exactly as it arrives: if the printer is thermal, it is best to send it in black and white.
For a counter sale, also send the term and the due date (payment.term: "Contado", invoice.paymentDate with the day’s date): the receipt says what is missing, and without them it prints «Sin plazo» (“No term”) and «Sin vencimiento» (“No due date”).
There are seven, and choosing one means changing only plantilla. Since a thermal printer prints in a single color, they are told apart by typeface, rules, boxes and black bands, and what you see on screen is what gets printed.
plantilla |
What it looks like |
|---|---|
tirilla |
Premium: understated, with dashed rules between blocks |
tirilla-destacada |
The total in a black bar with white text and the header between two thick rules |
tirilla-clasica |
All in Courier, like the classic cash register |
tirilla-minimalista |
No rules, more space between blocks and small labels |
tirilla-corporativa |
Each block in its own solid-bordered box |
tirilla-moderna |
Section labels in uppercase on black bands, and a large total |
tirilla-estandar |
Compact: the shortest on paper, for high volume |
Solid black areas
tirilla-destacada —the total bar— and tirilla-moderna —one band per label— print solid black areas. A thermal printer can print them, but each model darkens them in its own way and they use more print head and thermal paper: do a test print on the target printer before choosing them.
The other documents
For now:
| Type | Designs |
|---|---|
nota-credito |
premium |
nota-debito |
premium |
recibo-de-caja |
estandar —the default— and premium |
estado-de-cuenta |
premium |
colilla-de-nomina |
azul —the default—, esmeralda, violeta, grafito and ambar; premium, the former name of grafito |
informe |
premium |
entrada-de-inventario, salida-de-inventario, traslado-de-inventario |
premium |
cuenta-de-cobro, contrato |
estandar |
The credit note, the debit note, the Premium cash receipt, the account statement, the report and the inventory movements share the look of the Premium invoice: the same header, the same block with the customer and the document data, the same margin and the footer in the same place. That way, everything a company issues looks like one family.
If you don’t send plantilla, you get the default design —the same as always—, so existing integrations don’t need to change anything. A plantilla that doesn’t exist responds 400 with the list of the ones that do, so you don’t have to go looking for it elsewhere.
Listing the available designs
A GET to the same address returns the catalog: the types, their designs, which one is the default and a description of each.
curl https://docsgen.piensait.com/api/documents
It lets you offer a picker in your application without keeping a hand-written list. A copied list goes stale the day we add a design, and nobody notices until someone requests one that no longer exists. It needs no key.
The style of each design
We can adjust the style of a design —its colors and, on the receipts, its black features: typeface, rules, boxes and bands— without you changing anything in your integration. What never changes with a style is what you send and what the document says: the same type, the same plantilla, the same data, the same sections in the same order and the same tax data. A style only changes how it looks. Before applying one, we compose it with a sample document and check that it is readable and takes up the same space; if not, it is not applied. An adjustment takes up to a minute to reach all documents.
To know which style each design is drawn with, the catalog includes in each one:
estilo: the colors or features it comes out with today.versionDeEstilo: the version of that style, ornullif it is the original one.
A design that doesn’t support styles —the contract, the collection account— has both set to null. They are the same values used by the document you request with that design, so you can use them to show an accurate preview in your picker.
And each document says which one it came out with, in the x-docgen-estilo response header: factura/premium@v3 if it used version 3 of that design’s style, or factura/premium@codigo if it used the original one. If you ever need to recompose a document identical to one you delivered, store that value alongside it.
