Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions pos/src/lib/invoice-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ export async function getInvoicePrintHtml(invoiceId: string, printFormat: string
name: invoiceId,
print_format: printFormat,
_lang: 'en',
no_letterhead: 1,
letterhead:"No Letterhead",
settings:{}
}
);
return response.message.html;
Expand All @@ -159,13 +162,6 @@ export async function selectNetworkPrinter(orderId: string, posProfile: string,
});
}

export async function printPosPage(orderId: string, printFormat: string) {
await call.post('ury.ury.api.ury_print.print_pos_page', {
doctype: 'POS Invoice',
name: orderId,
print_format: printFormat,
});
}

export async function updatePrintStatus(orderId: string) {
await call.post('ury.ury.api.ury_print.qz_print_update', { invoice: orderId });
Expand Down
7 changes: 4 additions & 3 deletions pos/src/lib/print.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
getInvoicePrintHtml,
networkPrint,
selectNetworkPrinter,
printPosPage,
updatePrintStatus
} from './invoice-api';
import { PosProfileCombined } from './pos-profile-api';
Expand Down Expand Up @@ -33,7 +32,9 @@ export async function printOrder({ orderId, posProfile }: PrintOrderParams): Pro
await updatePrintStatus(orderId);
return 'network';
} else {
await printPosPage(orderId, print_format as string);
// Redirect to printview page
const url=`/printview?doctype=POS Invoice&name=${orderId}&format=${print_format}&no_letterhead=1&settings={}&letterhead=No Letterhead&trigger_print=1&_lang=en`;
window.open(url, '_blank', 'noopener,noreferrer');
return 'socket';
}
}
}
20 changes: 5 additions & 15 deletions urypos/src/stores/invoiceData.js
Original file line number Diff line number Diff line change
Expand Up @@ -576,21 +576,11 @@ export const useInvoiceDataStore = defineStore("invoiceData", {
};
}
} else {
const sendObj = {
doctype: "POS Invoice",
name: invoiceNo,
print_format: this.print_format,
};
this.call
.post("ury.ury.api.ury_print.print_pos_page", sendObj)
.then((result) => {
this.notification.createNotification("Print Successful");
this.isPrinting = false
window.location.reload();

return result.message;
})
.catch((error) => console.error(error));
// Socket printing using printview redirection
const url = `/printview?doctype=POS Invoice&name=${invoiceNo}&format=${this.print_format}&no_letterhead=1&settings={}&letterhead=No Letterhead&trigger_print=1&_lang=en`;
window.open(url, "_blank", "noopener,noreferrer");
this.notification.createNotification("Print triggered");
this.isPrinting = false;
}
} catch (e) {
if (e?.custom) {
Expand Down
Loading