Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- componentDidMount() {
- this.loadData()
- }
- loadData() {
- let data = [
- {
- categories: "Food"
- created_at: "2019-12-01 06:54:01"
- deleted_at: null
- desc: "Karage Gurih"
- id: 42
- inf_categories_id: "5"
- inf_modifier_set_id: null
- multiple_price: null
- name: "Karage"
- sku: null
- total: 20000
- },
- {
- categories: "Food"
- created_at: "2019-12-01 06:54:01"
- deleted_at: null
- desc: "Karage Gurih"
- id: 41
- inf_categories_id: "5"
- inf_modifier_set_id: null
- multiple_price: null
- name: "Karage"
- sku: null
- total: 20000
- }
- ]
- this.setState({
- data: data
- })
- }
- async printData() {
- let data = this.state.data
- for(let i=0; i<data.length; i++){
- await BluetoothEscposPrinter.printerLeftSpace(0);
- await BluetoothEscposPrinter.printColumn([BluetoothEscposPrinter.width58 / 8 / 3, BluetoothEscposPrinter.width58 / 8 / 3 - 1, BluetoothEscposPrinter.width58 / 8 / 3 - 1],
- [BluetoothEscposPrinter.ALIGN.CENTER, BluetoothEscposPrinter.ALIGN.CENTER, BluetoothEscposPrinter.ALIGN.CENTER],
- ["Categories", data[i].categories], { fonttype: 1 });
- await BluetoothEscposPrinter.printText("\r\n\r\n\r\n", {});
- await BluetoothEscposPrinter.printerLeftSpace(0);
- await BluetoothEscposPrinter.printColumn([BluetoothEscposPrinter.width58 / 8 / 3, BluetoothEscposPrinter.width58 / 8 / 3 - 1, BluetoothEscposPrinter.width58 / 8 / 3 - 1],
- [BluetoothEscposPrinter.ALIGN.CENTER, BluetoothEscposPrinter.ALIGN.CENTER, BluetoothEscposPrinter.ALIGN.CENTER],
- ["Create At", data[i].created_at], { fonttype: 1 });
- await BluetoothEscposPrinter.printText("\r\n\r\n\r\n", {});
- await BluetoothEscposPrinter.printerLeftSpace(0);
- await BluetoothEscposPrinter.printColumn([BluetoothEscposPrinter.width58 / 8 / 3, BluetoothEscposPrinter.width58 / 8 / 3 - 1, BluetoothEscposPrinter.width58 / 8 / 3 - 1],
- [BluetoothEscposPrinter.ALIGN.CENTER, BluetoothEscposPrinter.ALIGN.CENTER, BluetoothEscposPrinter.ALIGN.CENTER],
- ["Deleted At", data[i].deleted_at], { fonttype: 1 });
- await BluetoothEscposPrinter.printText("\r\n\r\n\r\n", {});
- await BluetoothEscposPrinter.printerLeftSpace(0);
- await BluetoothEscposPrinter.printColumn([BluetoothEscposPrinter.width58 / 8 / 3, BluetoothEscposPrinter.width58 / 8 / 3 - 1, BluetoothEscposPrinter.width58 / 8 / 3 - 1],
- [BluetoothEscposPrinter.ALIGN.CENTER, BluetoothEscposPrinter.ALIGN.CENTER, BluetoothEscposPrinter.ALIGN.CENTER],
- ["Desc", data[i].desc], { fonttype: 1 });
- await BluetoothEscposPrinter.printText("\r\n\r\n\r\n", {});
- await BluetoothEscposPrinter.printerLeftSpace(0);
- await BluetoothEscposPrinter.printColumn([BluetoothEscposPrinter.width58 / 8 / 3, BluetoothEscposPrinter.width58 / 8 / 3 - 1, BluetoothEscposPrinter.width58 / 8 / 3 - 1],
- [BluetoothEscposPrinter.ALIGN.CENTER, BluetoothEscposPrinter.ALIGN.CENTER, BluetoothEscposPrinter.ALIGN.CENTER],
- ["ID", data[i].id], { fonttype: 1 });
- await BluetoothEscposPrinter.printText("\r\n\r\n\r\n", {});
- await BluetoothEscposPrinter.printerLeftSpace(0);
- await BluetoothEscposPrinter.printColumn([BluetoothEscposPrinter.width58 / 8 / 3, BluetoothEscposPrinter.width58 / 8 / 3 - 1, BluetoothEscposPrinter.width58 / 8 / 3 - 1],
- [BluetoothEscposPrinter.ALIGN.CENTER, BluetoothEscposPrinter.ALIGN.CENTER, BluetoothEscposPrinter.ALIGN.CENTER],
- ["Inf Categories ID", data[i].inf_categories_id], { fonttype: 1 });
- await BluetoothEscposPrinter.printText("\r\n\r\n\r\n", {});
- await BluetoothEscposPrinter.printerLeftSpace(0);
- await BluetoothEscposPrinter.printColumn([BluetoothEscposPrinter.width58 / 8 / 3, BluetoothEscposPrinter.width58 / 8 / 3 - 1, BluetoothEscposPrinter.width58 / 8 / 3 - 1],
- [BluetoothEscposPrinter.ALIGN.CENTER, BluetoothEscposPrinter.ALIGN.CENTER, BluetoothEscposPrinter.ALIGN.CENTER],
- ["Inf Modifier Set ID", data[i].inf_modifier_set_id], { fonttype: 1 });
- await BluetoothEscposPrinter.printText("\r\n\r\n\r\n", {});
- await BluetoothEscposPrinter.printerLeftSpace(0);
- await BluetoothEscposPrinter.printColumn([BluetoothEscposPrinter.width58 / 8 / 3, BluetoothEscposPrinter.width58 / 8 / 3 - 1, BluetoothEscposPrinter.width58 / 8 / 3 - 1],
- [BluetoothEscposPrinter.ALIGN.CENTER, BluetoothEscposPrinter.ALIGN.CENTER, BluetoothEscposPrinter.ALIGN.CENTER],
- ["Multiple Price", data[i].multiple_price], { fonttype: 1 });
- await BluetoothEscposPrinter.printText("\r\n\r\n\r\n", {});
- await BluetoothEscposPrinter.printerLeftSpace(0);
- await BluetoothEscposPrinter.printColumn([BluetoothEscposPrinter.width58 / 8 / 3, BluetoothEscposPrinter.width58 / 8 / 3 - 1, BluetoothEscposPrinter.width58 / 8 / 3 - 1],
- [BluetoothEscposPrinter.ALIGN.CENTER, BluetoothEscposPrinter.ALIGN.CENTER, BluetoothEscposPrinter.ALIGN.CENTER],
- ["Name", data[i].name], { fonttype: 1 });
- await BluetoothEscposPrinter.printText("\r\n\r\n\r\n", {});
- await BluetoothEscposPrinter.printerLeftSpace(0);
- await BluetoothEscposPrinter.printColumn([BluetoothEscposPrinter.width58 / 8 / 3, BluetoothEscposPrinter.width58 / 8 / 3 - 1, BluetoothEscposPrinter.width58 / 8 / 3 - 1],
- [BluetoothEscposPrinter.ALIGN.CENTER, BluetoothEscposPrinter.ALIGN.CENTER, BluetoothEscposPrinter.ALIGN.CENTER],
- ["SKU", data[i].sku], { fonttype: 1 });
- await BluetoothEscposPrinter.printText("\r\n\r\n\r\n", {});
- await BluetoothEscposPrinter.printerLeftSpace(0);
- await BluetoothEscposPrinter.printColumn([BluetoothEscposPrinter.width58 / 8 / 3, BluetoothEscposPrinter.width58 / 8 / 3 - 1, BluetoothEscposPrinter.width58 / 8 / 3 - 1],
- [BluetoothEscposPrinter.ALIGN.CENTER, BluetoothEscposPrinter.ALIGN.CENTER, BluetoothEscposPrinter.ALIGN.CENTER],
- ["Total", data[i].total], { fonttype: 1 });
- await BluetoothEscposPrinter.printText("\r\n\r\n\r\n", {});
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement