Credito
This commit is contained in:
@@ -77,6 +77,13 @@ app.post('/digitalpowerstock/ticket/venta', (req, res) => {
|
|||||||
res.send(200)
|
res.send(200)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
app.post('/digitalpowerstock/ticket/credito', (req, res) => {
|
||||||
|
const { monto, cliente, fecha } = req.body;
|
||||||
|
|
||||||
|
ticketCredito(monto, cliente, fecha)
|
||||||
|
res.send(200)
|
||||||
|
})
|
||||||
|
|
||||||
app.post('/digitalpowerstock/ticket/gondola', (req, res) => {
|
app.post('/digitalpowerstock/ticket/gondola', (req, res) => {
|
||||||
const { nombre, top_price, off, bottom_price } = req.body;
|
const { nombre, top_price, off, bottom_price } = req.body;
|
||||||
|
|
||||||
@@ -383,6 +390,46 @@ async function ticketDPSTockGondola(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function ticketCredito(monto, cliente, fecha) {
|
||||||
|
try {
|
||||||
|
let ticket = "";
|
||||||
|
|
||||||
|
// Encabezado
|
||||||
|
ticket += init();
|
||||||
|
ticket += center();
|
||||||
|
ticket += textDoubleSize() + boldOn() + "NOTA DE CREDITO" + boldOff() + textNormal() + line(2);
|
||||||
|
|
||||||
|
ticket += left();
|
||||||
|
ticket += "Cliente: " + cliente + line();
|
||||||
|
ticket += "Fecha: " + fecha + line(2);
|
||||||
|
|
||||||
|
ticket += printDoubleLine();
|
||||||
|
|
||||||
|
ticket += boldOn();
|
||||||
|
const formattedMonto = !isNaN(Number(monto)) ? Number(monto).toFixed(2) : monto;
|
||||||
|
ticket += printBetween("Monto a favor: ", `$${formattedMonto}`) + line(3);
|
||||||
|
ticket += boldOff();
|
||||||
|
|
||||||
|
// Corte
|
||||||
|
ticket += cut();
|
||||||
|
|
||||||
|
// Convertir a CP850 (acentos correctos)
|
||||||
|
const data = iconv.encode(ticket, "CP850");
|
||||||
|
|
||||||
|
// Enviar a la impresora
|
||||||
|
printer.printDirect({
|
||||||
|
data,
|
||||||
|
printer: printer.getDefaultPrinterName(),
|
||||||
|
type: "RAW",
|
||||||
|
success: jobID => console.log("Trabajo enviado:", jobID),
|
||||||
|
error: err => console.error("Error:", err)
|
||||||
|
});
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error al imprimir:", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function ticketPedido(
|
async function ticketPedido(
|
||||||
cliente, direccion, altura, ciudad, cp, telefono, email, comprobante, fecha, productos, total, estado, tipo_envio, tipo_pago, calles
|
cliente, direccion, altura, ciudad, cp, telefono, email, comprobante, fecha, productos, total, estado, tipo_envio, tipo_pago, calles
|
||||||
) {
|
) {
|
||||||
|
|||||||
Reference in New Issue
Block a user