List of usage examples for java.awt List add
public void add(String item)
From source file:com.openbravo.pos.sales.JRetailPanelTicket.java
private synchronized void printRetailKotTicket(String sresourcename, RetailTicketInfo ticket, java.util.List<RetailTicketLineInfo> kot, Object ticketExt, java.util.List<ProductionPrinterInfo> printerInfo, int kotTicket, String floorName) { java.util.List<TicketLineConstructor> allLines = null; logger.info("start printing the kot" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S").format(new Date())); com.openbravo.pos.printer.printer.KotImagePrinter printer = new KotImagePrinter(); com.openbravo.pos.printer.printer.KotBillPrinter printerKot = new KotBillPrinter(); String storeLocation = m_App.getProperties().getProperty("machine.storelocation"); kotTicketlist = kot;//from www . j av a 2 s. c o m //iterate the printers with non kot items for (int j = 0; j < printerInfo.size(); j++) { // list for saving the items having same production area type java.util.List<RetailTicketLineInfo> uniqueProductionAreas = new ArrayList<RetailTicketLineInfo>(); for (int i = 0; i < kotTicketlist.size(); i++) { // if printer production area type matches with item production area type , add the line to the list if (printerInfo.get(j).getProductionAreaType() .equals(kotTicketlist.get(i).getProductionAreaType())) { uniqueProductionAreas.add(kotTicketlist.get(i)); kotTicketlist.get(i).setProductionArea(printerInfo.get(j).getProductionArea()); } } logger.info("kot print count based on production areas" + uniqueProductionAreas.size()); if (uniqueProductionAreas.size() != 0) { allLines = getRetailAllLines(ticket, ticketExt, uniqueProductionAreas, kotTicket, floorName); try { // sending for kot print based on store if (storeLocation.equals("BlrIndranagar") || storeLocation.equals("BlrKoramangala") || storeLocation.equals("Chennai") || storeLocation.equals("Hyderabad")) { //Thermal ? printer.printKot(allLines, printerInfo.get(j).getPath()); } else { printerKot.print(allLines, printerInfo.get(j).getPath()); } for (int i = 0; i < uniqueProductionAreas.size(); i++) { kotlogger.info("KOT Printed Successfully " + "," + "Username: " + m_oTicket.printUser() + "," + "Total kot count: " + uniqueProductionAreas.size() + "," + "Printer Name: " + printerInfo.get(j).getPath() + "," + "Kot No: " + kotTicket + "," + "Table: " + m_oTicketExt.toString() + "," + "Order No: " + ticket.getOrderId() + "," + "Product Name: " + uniqueProductionAreas.get(i).getProductName() + "," + "Qty: " + uniqueProductionAreas.get(i).getMultiply() + "," + "Timestamp: " + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S").format(new Date())); uniqueProductionAreas.get(i).setIsKot(1); if (uniqueProductionAreas.get(i).getPreparationStatus() != 3) { uniqueProductionAreas.get(i).setPreparationStatus(4); } System.out.println("uniqueProductionAreas.get(i). Station : " + uniqueProductionAreas.get(i).getStation()); //New KDS Added on 7-03-17 String txstatus = "ADD"; String tableid_unique = uniqueProductionAreas.get(i).getTbl_orderId(); dlReceipts.insertServedTransaction(m_oTicket, txstatus, tableid_unique); } } catch (PrinterException ex) { logger.info("Order NO." + m_oTicket.getOrderId() + " The printer action" + ex.getMessage()); ex.printStackTrace(); kotprintIssue = 1; Logger.getLogger(JRetailPanelTicket.class.getName()).log(Level.SEVERE, null, ex); for (int i = 0; i < uniqueProductionAreas.size(); i++) { logger.info("KOT Print Failed " + "," + "Username: " + m_oTicket.printUser() + "," + "Total kot count: " + uniqueProductionAreas.size() + "," + "Printer Name: " + printerInfo.get(j).getPath() + "," + "Kot No: " + kotTicket + "," + "Table: " + m_oTicketExt.toString() + "," + "Order No: " + ticket.getOrderId() + "," + "Product Name: " + uniqueProductionAreas.get(i).getProductName() + "," + "Qty: " + uniqueProductionAreas.get(i).getMultiply() + "," + "Timestamp: " + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S").format(new Date())); uniqueProductionAreas.get(i).setIsKot(0); if (uniqueProductionAreas.get(i).getPreparationStatus() != 3) { uniqueProductionAreas.get(i).setPreparationStatus(0); } //New KDS Added on 7-03-17 String txstatus = "ADD"; String tableid_unique = uniqueProductionAreas.get(i).getTbl_orderId(); System.out.println( "uniqueProductionAreas Station " + uniqueProductionAreas.get(i).getStation()); dlReceipts.insertServedTransaction(m_oTicket, txstatus, tableid_unique); } kotaction = 1; showMessage(this, "KOT action not happened! Please retry"); } } } for (int i = 0; i < ticket.getLinesCount(); i++) { paintKotTicketLine(i, ticket.getLine(i)); } // Date updated = new Date(); Object[] values = new Object[] { m_oTicket.getPlaceId(), m_oTicket.getName(), m_oTicket, m_oTicket.getSplitSharedId(), m_oTicket.isPrinted(), m_oTicket.isListModified() }; Datas[] datas = new Datas[] { Datas.STRING, Datas.STRING, Datas.SERIALIZABLE, Datas.STRING, Datas.BOOLEAN, Datas.BOOLEAN }; try { try { new PreparedSentence(m_App.getSession(), "UPDATE SHAREDTICKETS SET NAME = ?, CONTENT = ?, ISPRINTED = ?, ISMODIFIED = ?,UPDATED=NOW() ,ISKDS=0 WHERE ID = ? AND SPLITID=? ", new SerializerWriteBasicExt(datas, new int[] { 1, 2, 4, 5, 0, 3 })).exec(values); } catch (BasicException ex) { logger.info("Order NO." + m_oTicket.getOrderId() + " exception in updating shared ticket" + ex.getMessage()); ex.printStackTrace(); Logger.getLogger(JRetailPanelTicket.class.getName()).log(Level.SEVERE, null, ex); } String splitId = m_oTicket.getSplitSharedId(); Object[] record = (Object[]) new StaticSentence(m_App.getSession(), "SELECT UPDATED FROM SHAREDTICKETS WHERE ID = ? AND SPLITID='" + splitId + "'", SerializerWriteString.INSTANCE, new SerializerReadBasic(new Datas[] { Datas.STRING })) .find(m_oTicket.getPlaceId()); if (record != null) { m_oTicket.setObjectUpdateDate(DateFormats.StringToDateTime((String) record[0])); } } catch (BasicException ex) { logger.info("Order NO." + m_oTicket.getOrderId() + " exception in printRetailKotTicket updating shared ticket" + ex.getMessage()); Logger.getLogger(JRetailPanelTicket.class.getName()).log(Level.SEVERE, null, ex); } logger.info("kot lines passing to print" + kotTicketlist.size()); logger.info("end printing the kot" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S").format(new Date())); }
From source file:org.fhcrc.cpl.viewer.gui.SpectrumComponent.java
/** * update the chart with new data/*from w w w . ja v a 2 s . c o m*/ */ public void updateChart(boolean preserveDomain) { _log.debug("updateChart: start"); float[][] spectrumIN = null; MSRun run = (MSRun) ApplicationContext.getProperty(SharedProperties.MS_RUN); MSRun.MSScan selectedScan = getSelectedScan(); FloatRange rangeSpectrum = null; // restricted range of displayed data (for autoZoom) Pair<Spectrum.Peak, Spectrum.Peak> chartRange = null; // tell other components what we are displaying Range domainRange = null; if (preserveDomain && _chart != null) domainRange = _chart.getXYPlot().getDomainAxis().getRange(); if (null == run || null == selectedScan) { clearChart(); //if no chart to display, show white background chartArea.setBackground(java.awt.Color.WHITE); return; } chartArea.setBackground(_backgroundColor); if ("scan".equals(_type)) { scanSpinner.setValue(new Integer(selectedScan.getNum())); double t = selectedScan.getDoubleRetentionTime(); timeTextField.setText("" + Math.round(t * 10) / 10.0); scanSpinner.setEnabled(true); //mzTextField.setText(""); //mzTextField.setEnabled(false); mzSpinner.setValue(new Double(_selectedMZ)); mzSpinner.setEnabled(false); /* ArrayList l = new ArrayList(); l.add(selectedScan.getSpectrum()); spectrumIN = Spectrum.CombineRawSpectra( run.getTemplateSpectrum(), l, new FloatRange(selectedScan.getLowMz(),selectedScan.getHighMz()) ); */ spectrumIN = selectedScan.getSpectrum(); if (autoZoom()) { // we don't want to filter the analyzed data, in case // that affects any of the algorithms // we only filter the result Datasets // UNDONE: choose range based on size of MSDetailPanel // range of 27+ is enough to see 4 ICAT labelled features (9*(4-1)) rangeSpectrum = new FloatRange((float) _selectedMZ - 10F, (float) _selectedMZ + 30F); } if (null == rangeSpectrum) { chartRange = new Pair<Spectrum.Peak, Spectrum.Peak>( new Spectrum.Peak(_selectedScanNum, spectrumIN[0][0], 0.0F), new Spectrum.Peak(_selectedScanNum, spectrumIN[0][spectrumIN[0].length - 1])); } else { chartRange = new Pair<Spectrum.Peak, Spectrum.Peak>( new Spectrum.Peak(_selectedScanNum, rangeSpectrum.min, 0.0F), new Spectrum.Peak(_selectedScanNum, rangeSpectrum.max, 0.0F)); } } else // elution { if (_selectedMZ == -1) { clearChart(); return; } int RESAMPLE = 36; float mz = (float) Math.round(_selectedMZ * RESAMPLE) / RESAMPLE; _log.debug("updateChart mz=" + mz); scanSpinner.setValue(new Integer(selectedScan.getNum())); scanSpinner.setEnabled(false); double t = selectedScan.getDoubleRetentionTime(); timeTextField.setText("" + Math.round(t * 10) / 10.0); //mzTextField.setText("" + mz); //mzTextField.setEnabled(true); mzSpinner.setValue(new Double(_selectedMZ)); mzSpinner.setEnabled(true); FloatArray arrayIntensity = new FloatArray(); FloatArray arrayScan = new FloatArray(); int scanIndex = run.getIndexForScanNum(selectedScan.getNum()); int scanStart = Math.max(0, scanIndex - 64); int scanEnd = Math.min(run.getScanCount() - 1, scanStart + 128); FloatRange r = new FloatRange(mz, mz); for (int s = scanStart; s < scanEnd; s++) { MSRun.MSScan scan = run.getScan(s); float[][] spectrumRaw = scan.getSpectrum(); float[] resample = Spectrum.Resample(spectrumRaw, r, RESAMPLE); float f = resample[0]; arrayIntensity.add(f); //arrayScan.add((float)scan.getDoubleRetentionTime()); // arrayScan.add((float)s); arrayScan.add((float) scan.getNum()); } spectrumIN = new float[][] { arrayScan.toArray(null), arrayIntensity.toArray(null) }; chartRange = new Pair<Spectrum.Peak, Spectrum.Peak>( new Spectrum.Peak(run.getScan(scanStart).getNum(), mz, 0.0F), new Spectrum.Peak(run.getScan(scanEnd).getNum(), mz, 0.0F)); } String mode = (String) displayMode.getSelectedItem(); java.util.List<XYSeriesCollection> listMultipleCharts = null; XYSeriesCollection series = new XYSeriesCollection(); series.setIntervalWidth(0.0); // // Process source spectrum // float[][] spectrum = new float[][] { (float[]) spectrumIN[0].clone(), (float[]) spectrumIN[1].clone() }; ProcessSpectrum: { if ("raw".equals(mode)) { break ProcessSpectrum; } if ("background centroided".equals(mode)) { if (run.getHeaderInfo().getDataProcessing().getCentroided() == 1) spectrum = FeatureStrategyCentroided.backgroundSpectrum(spectrum); break ProcessSpectrum; } if ("clean centroided".equals(mode)) { if (run.getHeaderInfo().getDataProcessing().getCentroided() == 1) spectrum = FeatureStrategyCentroided.cleanSpectrum(spectrum); break ProcessSpectrum; } // all subsequent processing expects resampling // don't resample elution profile if ("scan".equals(_type)) { int len = spectrum[0].length; spectrum = Spectrum.ResampleSpectrum(spectrumIN, new FloatRange((float) Math.floor(spectrum[0][0]), (float) Math.ceil(spectrum[0][len - 1])), 36, false); } else { spectrum[1] = Spectrum.MedianSmooth(spectrum[1]); Spectrum.SmoothALittle(spectrum[1]); } if ("resampled".equals(mode)) break ProcessSpectrum; /* if ("compressed".equals(mode)) (data encoding test) { float[] s = spectrum[1]; short c[] = new short[s.length]; double m = 1.0; for (int i = 0 ; i<c.length ; i++) m = Math.max(m, s[i]); double sqrt = Math.sqrt(m+1); m = Math.round(Math.log(sqrt))+1; double f = Math.floor(0x7fff / Math.log(sqrt)); m = 0; for (int i = 0 ; i<c.length ; i++) { c[i] = (short)(Math.round(Math.log((s[i]+1)/sqrt) * f)); m = Math.max(m, Math.abs(c[i])); } System.err.println("MAX " + m); for (int i = 0 ; i<c.length ; i++) s[i] = (float)((Math.exp((double)c[i]/f) * sqrt) - 1); break ProcessSpectrum; } */ // remove background for further processing if (run.getHeaderInfo().getDataProcessing().getCentroided() != 1) { int window = "scan".equals(_type) ? 72 : 15; float x[] = spectrum[1]; float bg[] = Spectrum.MinimaWindow(x, spectrum[0].length, window, null); for (int i = 0; i < bg.length; i++) bg[i] = Math.max(0, x[i] - bg[i]); spectrum = new float[][] { spectrum[0], bg }; } if ("subtract background".equals(mode)) break ProcessSpectrum; if (mode.startsWith("threshold")) { spectrum[1] = Spectrum.WaveletD3(spectrum[1], null); break ProcessSpectrum; } if ("peaks".equals(mode) || "smoothed".equals(mode)) { if ("scan".equals(_type)) { double s = Smooth2D.smoothYfactor; spectrum[1] = Spectrum.FFTsmooth(spectrum[1], s, false); } else { //FeatureStrategyPeakClusters.smoothTHRESHOLD sm = new FeatureStrategyPeakClusters.smoothTHRESHOLD(); spectrum[1] = SmootherCreator._thresholdElution(spectrum[1]); } break ProcessSpectrum; } } // ProcessSpectrum: // // This is the source spectrum // String name = mode.indexOf("peaks") != -1 ? "-spectrum" : "|spectrum"; series.addSeries(new SpectrumXYSeries(name, spectrum, rangeSpectrum)); _spectrum = spectrum; // // add additional series/charts // // show min/med for reference if (mode.equals("resampled") || mode.equals("subtract background")) { float[] T; if (mode.equals("resampled")) { T = Spectrum.MinimaWindow(spectrum[1], spectrum[0].length, 72, null); series.addSeries(new SpectrumXYSeries("-min", new float[][] { spectrum[0], T }, rangeSpectrum)); } T = Spectrum.MedianWindow(spectrum[1], spectrum[0].length, 72, false); series.addSeries(new SpectrumXYSeries("-med", new float[][] { spectrum[0], T }, rangeSpectrum)); } if (mode.startsWith("wavelet decomposition") || mode.startsWith("wavelet multiresolution")) { Filter f = new Filter("haar"); float[] signal = spectrum[1]; // Spectrum.PadToDouble(spectrum[1], 32); int N = spectrum[0].length; // signal.length; int levels = 5; //if ("wavelet decomposition 2".equals(mode)) Spectrum.SmoothALittle(signal); float[][] modwt1 = Transform.decompose(signal, N, levels, f, "modwt", "periodic", null); float[][] t = modwt1; if ("wavelet multiresolution".equals(mode)) { t = Transform.multiresolution(t, N, levels, f, "modwt", "periodic", null); } else if ("wavelet decomposition 2".equals(mode)) { float[][] mra = Transform.multiresolution(t, N, levels, f, "modwt", "periodic", null); float[][] modwt2 = Transform.decompose(t[2], N, levels, f, "modwt", "periodic", null); // show original, d1, and d2 float[] a = modwt1[2]; float[] b = modwt2[2]; float[] m = mra[2]; Spectrum.Rotate(a, -3); Spectrum.Rotate(b, -7); t = new float[][] { a, /*b,*/ m }; // b is a mirror image of m } // copy array into data series listMultipleCharts = new java.util.LinkedList<XYSeriesCollection>(); XYSeriesCollection ds = new XYSeriesCollection( new SpectrumXYSeries("spectrum", spectrum, rangeSpectrum)); ds.setIntervalWidth(0.0); listMultipleCharts.add(ds); for (int i = 0; i < t.length; i++) { //float[] s = Spectrum.UnpadToFloat(t[i], 32, null); float[][] l = new float[][] { spectrum[0], t[i] }; ds = new XYSeriesCollection(new SpectrumXYSeries("level " + (i + 1), l, rangeSpectrum)); ds.setIntervalWidth(0.0); listMultipleCharts.add(ds); } } else if (mode.startsWith("haar")) { int l = Integer.parseInt(mode.substring(4)); listMultipleCharts = new LinkedList<XYSeriesCollection>(); float[] t1 = Haar.transform(spectrum[1], l); float[] t2 = Haar.transform(t1, l); XYSeriesCollection ds = new XYSeriesCollection( new SpectrumXYSeries("spectrum", spectrum, rangeSpectrum)); ds.setIntervalWidth(0.0); listMultipleCharts.add(ds); XYSeriesCollection ds1 = new XYSeriesCollection( new SpectrumXYSeries(mode, new float[][] { spectrum[0], t1 }, rangeSpectrum)); ds1.setIntervalWidth(0.0); listMultipleCharts.add(ds1); XYSeriesCollection ds2 = new XYSeriesCollection( new SpectrumXYSeries(mode, new float[][] { spectrum[0], t2 }, rangeSpectrum)); ds2.setIntervalWidth(0.0); listMultipleCharts.add(ds2); } else if ("peaks".equals(mode) || "threshold peaks".equals(mode)) { double noise = 0.1; //"peaks".equals(mode) ? 2.0 : 1.0; // Spectrum.Noise(spectrum[1], 0, spectrum[1].length); int[] peakList = Spectrum.PickPeakIndexes(spectrum[1], noise); float[][] peaks = new float[2][peakList.length]; for (int i = 0; i < peakList.length; i++) { int p = peakList[i]; if (p >= spectrum[0].length) continue; peaks[0][i] = spectrum[0][p]; peaks[1][i] = spectrum[1][p]; } series.addSeries(new SpectrumXYSeries("|peaks", peaks, rangeSpectrum)); _spectrum = peaks; } else if ("wavelet peaks".equals(mode)) { //Spectrum.Peak[] peaks = Spectrum.WaveletPeaks(spectrum); Spectrum.Peak[] peaks = Spectrum.WaveletPeaksD3(spectrum); float[][] peakSpectrum = new float[2][peaks.length]; for (int p = 0; p < peaks.length; p++) { peakSpectrum[0][p] = peaks[p].mz; peakSpectrum[1][p] = peaks[p].intensity; } // show d3 and thresholded spectrum int levels = 3, N = spectrum[0].length; Filter f = new Filter("haar"); float[][] modwt = Transform.decompose(spectrum[1], N, levels, f, "modwt", "periodic", null); float[][] mra = Transform.multiresolution(modwt, N, levels, f, "modwt", "periodic", null); float[] thresholded = new float[N]; for (int i = 0; i < N; i++) thresholded[i] = mra[2][i] + mra[3][i]; series.removeAllSeries(); //series.addSeries(new SpectrumXYSeries("-spectrum", new float[][] {spectrum[0],thresholded}, rangeSpectrum)); series.addSeries(new SpectrumXYSeries("-mra", new float[][] { spectrum[0], mra[2] }, rangeSpectrum)); series.addSeries(new SpectrumXYSeries("|peaks", peakSpectrum, rangeSpectrum)); _spectrum = peakSpectrum; } // // now update or create chart // Color[] colors = series.getSeriesCount() == 3 ? new Color[] { Color.RED, Color.BLUE, Color.BLUE } : series.getSeriesCount() == 2 ? new Color[] { Color.BLUE, Color.RED } : new Color[] { Color.RED }; // NOTE: the more often we call setDatasets instead of creating new chart the better // CONSIDER: if we don't save chart, at least preserve zoom settings if (false && _chart != null && _chartPanel != null && !(_chart.getPlot() instanceof CombinedDomainXYPlot) && listMultipleCharts == null) { SpectrumChartFactory.setColors(_chartPanel, colors); _chart.getXYPlot().setDataset(series); _chartPanel.updateUI(); } else { if (listMultipleCharts == null) { _log.debug( "updateChart: series=" + series.getSeriesCount() + " length(0)=" + series.getItemCount(0)); _chartPanel = SpectrumChartFactory.CreateChartPanel(series, colors); } else { _log.debug("updateChart: charts=" + listMultipleCharts.size()); _chartPanel = SpectrumChartFactory.CreateChartPanel(listMultipleCharts, colors); } _chart = _chartPanel.getChart(); // there seem to be mystery margins so give a little extra space Dimension size = chartArea.getSize(); _chartPanel.setPreferredSize(new Dimension(size.width - 10, size.height - 10)); chartArea.removeAll(); chartArea.add(_chartPanel); chartArea.doLayout(); } if (null != domainRange) _chart.getXYPlot().getDomainAxis().setRange(domainRange); //dhmay: if the user has locked the Y axis, then try to use the stored Y axis range if (isYAxisLocked()) { //a locked axis value won't be available if the axis was _just_ locked if (null == _lockedYAxisRange) { //if we've already displayed a chart, use that chart's axis range. Otherwise, //don't force, and record this chart's axis range if (_previousYAxisRange != null) _lockedYAxisRange = _previousYAxisRange; else _lockedYAxisRange = _chart.getXYPlot().getRangeAxis().getRange(); } _chart.getXYPlot().getRangeAxis().setRange(_lockedYAxisRange); } else { //if the Y axis isn't locked, then dump the stored range so it isn't used later _lockedYAxisRange = null; } //always store the previous Y axis range if (_chart.getXYPlot() != null && _chart.getXYPlot().getRangeAxis() != null && _chart.getXYPlot().getRangeAxis().getRange() != null) { _previousYAxisRange = _chart.getXYPlot().getRangeAxis().getRange(); } ApplicationContext.setProperty(SharedProperties.CHART_RANGE, chartRange); }
From source file:com.openbravo.pos.sales.JRetailPanelTicket.java
private void printTicketGeneric(String sresourcename, RetailTicketInfo ticket, Object ticketext) { java.util.List<TicketLineConstructor> allLines = null; java.util.List<TicketLineConstructor> startallLines = new ArrayList<TicketLineConstructor>(); int count = 0; com.openbravo.pos.printer.printer.ImageBillPrinter printer = new ImageBillPrinter(); if (sresourcename.equals("Printer.Bill")) { allLines = getAllLines(ticket, ticketext); } else if (sresourcename.equals("Printer.NonChargableBill")) { allLines = getNonChargeableLines(ticket, ticketext); }/*from ww w. jav a2s . c om*/ int divideLines = allLines.size() / 48; int remainder = allLines.size() % 48; int value = 48; int k = 0; if (divideLines > 0) { for (int i = 0; i < divideLines; i++) { for (int j = k; j < value; j++) { startallLines.add(new TicketLineConstructor(allLines.get(j).getLine())); } try { printer.print(startallLines); } catch (PrinterException ex) { Logger.getLogger(JRetailPanelTicket.class.getName()).log(Level.SEVERE, null, ex); } if (allLines.size() > 48) { try { Thread.sleep(5000); } catch (InterruptedException ex) { Logger.getLogger(JRetailPanelTicket.class.getName()).log(Level.SEVERE, null, ex); } int res = JOptionPane.showConfirmDialog(this, AppLocal.getIntString("message.wannaPrintcontinue"), AppLocal.getIntString("message.title"), JOptionPane.OK_OPTION, JOptionPane.QUESTION_MESSAGE); if (res == JOptionPane.OK_OPTION) { k = value; value = value + 48; startallLines = new ArrayList<TicketLineConstructor>(); startallLines.clear(); } else { break; } } } } if (remainder > 0) { startallLines = new ArrayList<TicketLineConstructor>(); startallLines.clear(); for (int m = k; m < k + remainder; m++) { startallLines.add(new TicketLineConstructor(allLines.get(m).getLine())); } try { printer.print(startallLines); } catch (PrinterException ex) { Logger.getLogger(JRetailPanelTicket.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:com.openbravo.pos.sales.JRetailPanelTakeAway.java
private void addlinesaddBlankLines(int count, java.util.List<TicketLineConstructor> allLines) { for (int i = 0; i < count; i++) { allLines.add(new TicketLineConstructor("")); }/*from ww w . jav a 2s .com*/ }
From source file:com.openbravo.pos.sales.JRetailPanelTakeAway.java
private java.util.List<TicketLineConstructor> getNonChargeableLines(RetailTicketInfo ticket, Object ticketext) { java.util.List<TicketLineConstructor> allLines = new ArrayList<TicketLineConstructor>(); allLines.add(new TicketLineConstructor("Bill No:" + getSpaces(8) + ticket.getDocumentNo())); allLines.add(new TicketLineConstructor("Bill Date:" + getSpaces(6) + (ticket.printDate()))); allLines.add(new TicketLineConstructor("Customer:" + getSpaces(7) + (cusName.getText()))); allLines.add(new TicketLineConstructor("Table: " + getSpaces(9) + ticketext)); allLines.add(new TicketLineConstructor("Captain:" + getSpaces(8) + (ticket.printUser()))); // }/*w ww .j a v a 2 s .c o m*/ allLines.add(new TicketLineConstructor(getDottedLine(90))); allLines.add(new TicketLineConstructor( "Description" + getSpaces(17) + "Qty" + getSpaces(14) + "Price" + getSpaces(9) + "Value(INR)")); allLines.add(new TicketLineConstructor(getDottedLine(90))); for (RetailTicketLineInfo tLine : ticket.getLines()) { String prodName = tLine.printName(); String qty = tLine.printMultiply(); String subValue = tLine.printPriceLine(); String total = "0.00"; allLines.add(new TicketLineConstructor(prodName + getSpaces(28 - prodName.length()) + qty + getSpaces(15 - qty.length() + 7 - subValue.length()) + subValue + getSpaces(9 - qty.length() + 11 - subValue.length()) + total)); } System.out.println("ticket.getTaxes().get(0).getTaxInfo().getName();" + ticket.getTaxes().get(0).getTaxInfo().getName()); allLines.add(new TicketLineConstructor(getDottedLine(90))); allLines.add(new TicketLineConstructor(getSpaces(33) + "Total " + getSpaces(25) + "0.00")); allLines.add(new TicketLineConstructor(getSpaces(33) + "Discount " + getSpaces(22) + "0.00")); allLines.add(new TicketLineConstructor(getSpaces(33) + "Total After Discount " + getSpaces(10) + "0.00")); if (ticket.getTaxes().size() != 0) { for (int i = 0; i < ticket.getTaxes().size(); i++) { if (ticket.getTaxes().get(i).getTax() != 0.00) { allLines.add(new TicketLineConstructor(getSpaces(33) + ticket.getTaxes().get(i).getTaxInfo().getName() + getSpaces(31 - ticket.getTaxes().get(i).getTaxInfo().getName().length()) + "0.00")); } } } String aCount = ticket.printTicketCount(); allLines.add(new TicketLineConstructor(getSpaces(33) + "Service Charge 6%" + getSpaces(14) + "0.00")); allLines.add(new TicketLineConstructor(getSpaces(33) + "Service Tax 4.94%" + getSpaces(14) + "0.00")); allLines.add(new TicketLineConstructor(getSpaces(33) + "Grand Total : " + getSpaces(17) + "0.00")); //allLines.add(new TicketLineConstructor(announce3)); return allLines; }
From source file:com.openbravo.pos.sales.JRetailPanelTakeAway.java
private java.util.List<TicketLineConstructor> getCancelKotLines(RetailTicketInfo ticket, Object ticketext, RetailTicketLineInfo kotLine, String productionAreaName) { java.util.List<TicketLineConstructor> allLines = new ArrayList<TicketLineConstructor>(); double qtySum = 0; allLines.add(new TicketLineConstructor("\n")); allLines.add(new TicketLineConstructor("\n")); allLines.add(new TicketLineConstructor("\n")); allLines.add(new TicketLineConstructor("\n")); allLines.add(new TicketLineConstructor("\n")); allLines.add(new TicketLineConstructor(" " + "Cancel Kot Ticket")); allLines.add(new TicketLineConstructor(" " + productionAreaName)); allLines.add(new TicketLineConstructor("Date: " + (ticket.printDate().substring(0, 12)) + getSpaces(16 - (ticket.printDate().substring(0, 12).length())))); allLines.add(new TicketLineConstructor( "Time: " + (ticket.printTime()) + getSpaces(16 - (ticket.printTime().length())) + "Table No:" + getSpaces(1) + ticket.getName(m_oTicketExt))); allLines.add(new TicketLineConstructor("User Name: " + (m_oTicket.getUser()).getName())); allLines.add(new TicketLineConstructor(getDottedLine(70))); allLines.add(new TicketLineConstructor("Description " + "Qty")); allLines.add(new TicketLineConstructor(getDottedLine(70))); String prodName = kotLine.printName(); prodName = prodName.replaceAll("&", "&"); // String qty = Formats.DoubleValue.formatValue(tLine.printQty()); String qty = kotLine.printMultiply(); if (prodName.length() > 30) { prodName = WordUtils.wrap(prodName, 30); String[] prodNameArray = prodName.split("\n"); for (int i = 0; i < prodNameArray.length - 1; i++) { allLines.add(new TicketLineConstructor(prodNameArray[i])); }//from w w w. jav a 2 s. co m allLines.add(new TicketLineConstructor(prodNameArray[prodNameArray.length - 1] + getSpaces(33 - prodNameArray[prodNameArray.length - 1].length()) + qty)); } else { allLines.add(new TicketLineConstructor(prodName + getSpaces(33 - prodName.length()) + qty)); } allLines.add(new TicketLineConstructor(getDottedLine(70))); return allLines; }
From source file:com.openbravo.pos.sales.JRetailPanelTakeAway.java
private java.util.List<TicketLineConstructor> getRetailAllLines(RetailTicketInfo ticket, Object ticketext, java.util.List<RetailTicketLineInfo> kot, int kotTicket) { java.util.List<TicketLineConstructor> allLines = new ArrayList<TicketLineConstructor>(); double qtySum = 0; allLines.add(new TicketLineConstructor(" KITCHEN ORDER TICKET")); allLines.add(new TicketLineConstructor("Date: " + (ticket.printDate().substring(0, 12)) + getSpaces(16 - (ticket.printDate().substring(0, 12).length())) + "Kot No: " + kotTicket)); allLines.add(new TicketLineConstructor("Time: " + (ticket.printTime()) + getSpaces(16 - (ticket.printTime().length())) + "Table No:" + getSpaces(1) + "Takeaway")); allLines.add(new TicketLineConstructor("User Name: " + (m_oTicket.getUser()).getName())); allLines.add(new TicketLineConstructor(getDottedLine(70))); for (RetailTicketLineInfo tLine : kot) { String prodName = tLine.printName(); // String qty = Formats.DoubleValue.formatValue(tLine.printQty()); String qty = tLine.printMultiply(); qtySum = qtySum + tLine.getMultiply(); String instruction = tLine.printInstruction(); if (prodName.length() > 30) { prodName = WordUtils.wrap(prodName, 30); String[] prodNameArray = prodName.split("\n"); for (int i = 0; i < prodNameArray.length - 1; i++) { allLines.add(new TicketLineConstructor(prodNameArray[i])); }// w ww . j a v a 2s.c o m allLines.add(new TicketLineConstructor(prodNameArray[prodNameArray.length - 1] + getSpaces(33 - prodNameArray[prodNameArray.length - 1].length()) + qty)); if (instruction != null) { if (instruction.length() > 0) { String[] splitInstructValue = instruction.split(";"); for (int i = 0; i < splitInstructValue.length; i++) { if (splitInstructValue[i].length() > 0) { allLines.add(new TicketLineConstructor("I-[" + splitInstructValue[i] + "]")); } } } } } else { allLines.add(new TicketLineConstructor(prodName + getSpaces(33 - prodName.length()) + qty)); if (instruction != null) { if (instruction.length() > 0) { String[] splitInstructValue = instruction.split(";"); for (int i = 0; i < splitInstructValue.length; i++) { if (splitInstructValue[i].length() > 0) { allLines.add(new TicketLineConstructor("I-[" + splitInstructValue[i] + "]")); } } } } } } logger.info("sum of kot quantities = " + qtySum); return allLines; }
From source file:com.openbravo.pos.sales.JRetailPanelTakeAway.java
private java.util.List<TicketLineConstructor> getAllLines(RetailTicketInfo ticket, Object ticketext) { java.util.List<TicketLineConstructor> allLines = new ArrayList<TicketLineConstructor>(); allLines.add(new TicketLineConstructor(m_App.getProperties().getProperty("machine.address1"))); allLines.add(new TicketLineConstructor(m_App.getProperties().getProperty("machine.address2"))); allLines.add(new TicketLineConstructor(m_App.getProperties().getProperty("machine.address3"))); allLines.add(new TicketLineConstructor(m_App.getProperties().getProperty("machine.vatno"))); allLines.add(new TicketLineConstructor(m_App.getProperties().getProperty("machine.strc"))); allLines.add(new TicketLineConstructor("User:" + getSpaces(1) + (ticket.printUser()))); allLines.add(new TicketLineConstructor(getDottedLine(35))); allLines.add(new TicketLineConstructor("Bill No : " + getSpaces(1) + ticket.printId())); //allLines.add(new TicketLineConstructor("Table : " +getSpaces(1) + ticketext)); allLines.add(new TicketLineConstructor("Date : " + getSpaces(1) + (ticket.printDateForReceipt()) + getSpaces(2) + "Time: " + getSpaces(1) + (ticket.printTime()))); allLines.add(new TicketLineConstructor(getDottedLine(35))); allLines.add(new TicketLineConstructor("Item Name" + getSpaces(10) + "Qty" + getSpaces(5) + "Amount")); allLines.add(new TicketLineConstructor(getDottedLine(35))); for (RetailTicketLineInfo tLine : ticket.getUniqueLines()) { String prodName = tLine.printName(); String qty = tLine.printMultiply(); // String subValue = tLine.printPriceLine(); // String total = Formats.DoubleValue.formatValue(tLine.getSubValue()); String total = Formats.DoubleValue.formatValue(tLine.getSubValueBeforeDiscount()); System.out.println("prodname---" + prodName.length()); if (prodName.length() > 22) { prodName = WordUtils.wrap(prodName, 22); String[] prodNameArray = prodName.split("\n"); for (int i = 0; i < prodNameArray.length - 1; i++) { allLines.add(new TicketLineConstructor(prodNameArray[i])); }//from w ww .j a va 2 s . c o m allLines.add(new TicketLineConstructor(prodNameArray[prodNameArray.length - 1] + getSpaces(23 - prodNameArray[prodNameArray.length - 1].length()) + qty + getSpaces((10 - total.length())) + total)); } else { allLines.add(new TicketLineConstructor(prodName + getSpaces(23 - prodName.length()) + qty + getSpaces((10 - total.length())) + total)); } // if(prodName.length()>22){ // String prodName1 = prodName.substring(0, 22); // String prodName2= prodName.substring(22); // System.out.println("prodName1--"+prodName1+"---"+prodName2); // allLines.add(new TicketLineConstructor(qty + getSpaces(3) + prodName1+getSpaces(18 - prodName1.length()+total.length())+ total)); // allLines.add(new TicketLineConstructor(getSpaces(4) + prodName2)); // }else{ // allLines.add(new TicketLineConstructor(prodName + getSpaces(24 - prodName.length()) + qty + getSpaces(3) + (7 - total.length())+total)); //} } allLines.add(new TicketLineConstructor(getSpaces(20) + getDottedLine(15))); String subTotal = Formats.DoubleValue.formatValue(ticket.getSubTotal()); // String serviceCharge = Formats.DoubleValue.formatValue(ticket.getServiceCharge()); // String serviceTax = Formats.DoubleValue.formatValue(ticket.getServiceTax()); // String swachBharatTax = Formats.DoubleValue.formatValue(ticket.getSwatchBharatTax()); String discount = Formats.DoubleValue.formatValue(ticket.getLineDiscountOnCategory()); String totalAfrDiscount = Formats.DoubleValue.formatValue(ticket.getSubtotalAfterDiscount()); String roundoff = Formats.DoubleValue.formatValue(ticket.getRoundOffvalue()); String total = Formats.DoubleValue.formatValue(ticket.getTakeAwayTotal()); allLines.add(new TicketLineConstructor("SubTotal " + getSpaces(27 - subTotal.length()) + (subTotal))); allLines.add(new TicketLineConstructor(getSpaces(20) + getDottedLine(15))); allLines.add(new TicketLineConstructor("Discount " + getSpaces(25 - discount.length()) + ("-" + discount))); //allLines.add(new TicketLineConstructor("Total After Discount " + getSpaces(3) + (totalAfrDiscount))); String aCount = ticket.printTicketCount(); //allLines.add(new TicketLineConstructor("Service Charge" + getSpaces(21-serviceCharge.length()) + serviceCharge)); // if(ticket.getCharges().size()!=0){ // for(int i=0;i<ticket.getCharges().size();i++){ // System.out.println("ticket.getTaxes().get(i).getTax()--"+ticket.getCharges().get(i).getRetailSCharge()); // if(ticket.getCharges().get(i).getRetailSCharge()!=0.00){ // allLines.add(new TicketLineConstructor(ticket.getCharges().get(i).getServiceChargeInfo().getName() + getSpaces(15 - Formats.DoubleValue.formatValue(ticket.getTaxes().get(i).getRetailTax()).length()) + (Formats.DoubleValue.formatValue(ticket.getCharges().get(i).getRetailSCharge())))); // // } // } //calling consolidated tax (logic applied to bring erp tax configuration) by Shilpa if (ticket.getTaxes().size() != 0) { for (Map.Entry<String, NameTaxMapInfo> entry : m_oTicket.getNametaxMap().entrySet()) { String taxName = entry.getValue().getName(); ; double taxValue = entry.getValue().getTaxValue(); if (taxValue != 0.00) { allLines.add(new TicketLineConstructor(taxName + getSpaces( 35 - (Formats.DoubleValue.formatValue(taxValue).length() + taxName.length())) + (Formats.DoubleValue.formatValue(taxValue)))); } } } // if(ticket.getTaxes().size()!=0){ // for(int i=0;i<ticket.getTaxes().size();i++){ // System.out.println("ticket.getTaxes().get(i).getTax()--"+ticket.getTaxes().get(i).getTax()); // if(ticket.getTaxes().get(i).getTax()!=0.00){ // allLines.add(new TicketLineConstructor(ticket.getTaxes().get(i).getTaxInfo().getName() + getSpaces(27 - Formats.DoubleValue.formatValue(ticket.getTaxes().get(i).getRetailTax()).length()) + (Formats.DoubleValue.formatValue(ticket.getTaxes().get(i).getRetailTax())))); // } // } // // } // // if(ticket.getServiceTaxes().size()!=0){ // for(int i=0;i<ticket.getServiceTaxes().size();i++){ // System.out.println("ticket.getServiceTaxes().get(i).getTax()--"+ticket.getServiceTaxes().get(i).getRetailServiceTax()); // if(ticket.getServiceTaxes().get(i).getRetailServiceTax()!=0.00){ // allLines.add(new TicketLineConstructor(ticket.getServiceTaxes().get(i).getTaxInfo().getName() + getSpaces(17 - Formats.DoubleValue.formatValue(ticket.getServiceTaxes().get(i).getRetailServiceTax()).length()) + (Formats.DoubleValue.formatValue(ticket.getServiceTaxes().get(i).getRetailServiceTax())))); // } // } // // } // // allLines.add(new TicketLineConstructor("Service Tax" + getSpaces(24-serviceTax.length()) +serviceTax)); // //allLines.add(new TicketLineConstructor("Swach Bharat Tax" + getSpaces(19-swachBharatTax.length()) +swachBharatTax)); // if(ticket.getSwachBharatTaxes().size()!=0){ // for(int i=0;i<ticket.getSwachBharatTaxes().size();i++){ // System.out.println("ticket.getServiceTaxes().get(i).getTax()--"+ticket.getSwachBharatTaxes().get(i).getRetailSwachBharatTax()); // if(ticket.getSwachBharatTaxes().get(i).getRetailSwachBharatTax()!=0.00){ // allLines.add(new TicketLineConstructor(ticket.getSwachBharatTaxes().get(i).getTaxInfo().getName() + getSpaces(11 - Formats.DoubleValue.formatValue(ticket.getSwachBharatTaxes().get(i).getRetailSwachBharatTax()).length()) + (Formats.DoubleValue.formatValue(ticket.getSwachBharatTaxes().get(i).getRetailSwachBharatTax())))); // } // } // // } // allLines.add(new TicketLineConstructor("Round Off: " + getSpaces(24-roundoff.length()) + roundoff)); allLines.add(new TicketLineConstructor(getSpaces(20) + getDottedLine(15))); allLines.add(new TicketLineConstructor("Total Amount : " + getSpaces(20 - total.length()) + (total))); allLines.add(new TicketLineConstructor(getSpaces(20) + getDottedLine(15))); allLines.add(new TicketLineConstructor("Thank you! Please Visit Us again")); return allLines; }
From source file:com.openbravo.pos.sales.JRetailPanelTakeAway.java
private synchronized void printRetailKotTicket(String sresourcename, RetailTicketInfo ticket, java.util.List<RetailTicketLineInfo> kot, Object ticketExt, java.util.List<ProductionPrinterInfo> printerInfo, int kotTicket) { java.util.List<TicketLineConstructor> allLines = null; logger.info("start printing the kot" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S").format(new Date())); com.openbravo.pos.printer.printer.KotImagePrinter printer = new KotImagePrinter(); com.openbravo.pos.printer.printer.KotBillPrinter printerKot = new KotBillPrinter(); String storeLocation = m_App.getProperties().getProperty("machine.storelocation"); kotTicketlist = kot;//from w w w . j a v a 2s . com for (int j = 0; j < printerInfo.size(); j++) { java.util.List<RetailTicketLineInfo> uniqueProductionAreas = new ArrayList<RetailTicketLineInfo>(); for (int i = 0; i < kotTicketlist.size(); i++) { if (printerInfo.get(j).getProductionAreaType() .equals(kotTicketlist.get(i).getProductionAreaType())) { uniqueProductionAreas.add(kotTicketlist.get(i)); kotTicketlist.get(i).setProductionArea(printerInfo.get(j).getProductionArea()); } } logger.info("kot print count based on production areas" + uniqueProductionAreas.size()); // System.out.println("unique---"+uniqueProductionAreas.get(j).printName()); System.out.println("uniqueProductionAreas:" + uniqueProductionAreas.size()); if (uniqueProductionAreas.size() != 0) { allLines = getRetailAllLines(ticket, ticketExt, uniqueProductionAreas, kotTicket); try { if (storeLocation.equals("BlrIndranagar") || storeLocation.equals("BlrKoramangala") || storeLocation.equals("Chennai") || storeLocation.equals("Hyderabad")) { printer.printKot(allLines, printerInfo.get(j).getPath()); } else { printerKot.print(allLines, printerInfo.get(j).getPath()); } // kotprintIssue=0; // kotlogger.info("items printed successfully "+"By "+m_oTicket.printUser()+""+" in POS System "+m_App.getProperties().getPosNo()+" Table name "+m_oTicketExt.toString()); for (int i = 0; i < uniqueProductionAreas.size(); i++) { // kotlogger.info(uniqueProductionAreas.get(i).getProductName()); kotlogger.info("KOT Printed Successfully " + "," + "Username: " + m_oTicket.printUser() + "," + "Total kot count: " + uniqueProductionAreas.size() + "," + "Printer Name: " + printerInfo.get(j).getPath() + "," + "Kot No: " + kotTicket + "," + "," + "Order No: " + ticket.getOrderId() + "," + "Product Name: " + uniqueProductionAreas.get(i).getProductName() + "," + "Qty: " + uniqueProductionAreas.get(i).getMultiply() + "," + "Timestamp: " + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S").format(new Date())); uniqueProductionAreas.get(i).setIsKot(1); if (uniqueProductionAreas.get(i).getPreparationStatus() != 3) { uniqueProductionAreas.get(i).setPreparationStatus(4); } //New KDS Added on 7-03-17 String txstatus = "ADD"; String tableid_unique = uniqueProductionAreas.get(i).getTbl_orderId(); System.out.println("STATION: " + uniqueProductionAreas.get(i).getStation()); dlReceipts.insertServedTransaction(m_oTicket, txstatus, tableid_unique); } } catch (PrinterException ex) { logger.info("Order NO." + m_oTicket.getOrderId() + " The printer action" + ex.getMessage()); kotprintIssue = 1; System.out.println("within the catch of printer"); Logger.getLogger(JRetailPanelTakeAway.class.getName()).log(Level.SEVERE, null, ex); for (int i = 0; i < uniqueProductionAreas.size(); i++) { // kotlogger.info("items failed to print "+"By "+m_oTicket.printUser()+""+" in POS System "+m_App.getProperties().getPosNo()+" Table name "+m_oTicketExt.toString()); // kotlogger.info("items failed to print :"+uniqueProductionAreas.get(i).getProductName()); logger.info("KOT Print Failed " + "," + "Username: " + m_oTicket.printUser() + "," + "Total kot count: " + uniqueProductionAreas.size() + "," + "Printer Name: " + printerInfo.get(j).getPath() + "," + "Kot No: " + kotTicket + "," + "Table: " + m_oTicketExt.toString() + "," + "Order No: " + ticket.getOrderId() + "," + "Product Name: " + uniqueProductionAreas.get(i).getProductName() + "," + "Qty: " + uniqueProductionAreas.get(i).getMultiply() + "," + "Timestamp: " + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S").format(new Date())); uniqueProductionAreas.get(i).setIsKot(0); if (uniqueProductionAreas.get(i).getPreparationStatus() != 3) { uniqueProductionAreas.get(i).setPreparationStatus(0); } //New KDS Added on 7-03-17 String txstatus = "ADD"; String tableid_unique = uniqueProductionAreas.get(i).getTbl_orderId(); dlReceipts.insertServedTransaction(m_oTicket, txstatus, tableid_unique); } kotaction = 1; showMessage(this, "KOT action not happened! Please retry"); } } } for (int i = 0; i < ticket.getLinesCount(); i++) { paintKotTicketLine(i, ticket.getLine(i)); } // Object[] values = new Object[] {m_oTicket.getPlaceId(), m_oTicket.getName(), m_oTicket,m_oTicket.getSplitSharedId(),m_oTicket.isPrinted(),m_oTicket.isListModified()}; // Datas[] datas = new Datas[] {Datas.STRING, Datas.STRING, Datas.SERIALIZABLE, Datas.STRING,Datas.BOOLEAN,Datas.BOOLEAN}; // try { // new PreparedSentence(m_App.getSession() // , "UPDATE SHAREDTICKETS SET NAME = ?, CONTENT = ?, ISPRINTED = ?, ISMODIFIED = ? WHERE ID = ? AND SPLITID=? " // , new SerializerWriteBasicExt(datas, new int[] {1, 2, 4, 5, 0,3})).exec(values); // } catch (BasicException ex) { // logger.info("Order NO."+m_oTicket.getOrderId()+" exception in printRetailKotTicket updating shared ticket"+ex.getMessage()); // Logger.getLogger(JRetailPanelTakeAway.class.getName()).log(Level.SEVERE, null, ex); // } logger.info("kot lines passing to print" + kotTicketlist.size()); logger.info("end printing the kot" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S").format(new Date())); }
From source file:com.openbravo.pos.sales.JRetailPanelTicket.java
public final synchronized void kotDisplay() throws BasicException { // System.out.println("ticket.setObjectUpdateDate KOT1 : " + m_oTicket.getObjectUpdateDate()); boolean updated = checkTicketUpdation(); System.out.println("updated " + updated); if (!updated) { dbUpdatedDate = null;/*www. j a v a 2 s.co m*/ kotprintIssue = 0; logger.info("kotaction value" + kotaction); int orderId = 0; if (m_oTicket.getOrderId() == 0) { if (m_oTicket.getLinesCount() != 0) { //Setting the new order no orderId = dlSales.getNextTicketOrderNumber(); m_oTicket.setOrderId(orderId); } } final int kotTicket; int kotTicketId = 0; kotTicketId = dlSales.getNextKotIndex(); if (kotTicketId == 0) { kotTicket = 1; } else { kotTicket = kotTicketId; } RetailTicketInfo info = getActiveTicket(); java.util.List<kotPrintedInfo> kPrintedInfolist = null; //Getting all the lines from current bill final java.util.List<RetailTicketLineInfo> panelLines = info.getLines(); final java.util.List<RetailTicketLineInfo> panelNonKotLines = new ArrayList(); String sessionId = null; String floorName = null; java.util.List<Floor> m_afloors; //Fetch the floor id and based on floor id get all the printer details SentenceList sent = new StaticSentence(m_App.getSession(), "SELECT FLOORS.ID, FLOORS.NAME,'' FROM PLACES LEFT JOIN FLOORS ON PLACES.FLOOR=FLOORS.ID WHERE PLACES.ID='" + m_oTicket.getPlaceId() + "'", null, new SerializerReadClass(Floor.class)); m_afloors = sent.list(); // sessionId = dlReceipts.getFloorId(m_oTicket.getPlaceId()); sessionId = m_afloors.get(0).getID(); floorName = m_afloors.get(0).getName(); printerInfo = dlReceipts.getPrinterInfo(sessionId); for (int i = 0; i < panelLines.size(); i++) { //Add all the non kot lines to the list for printing the kot based on production area if (panelLines.get(i).getIsKot() == 0) { String tbl_orderitemId = UUID.randomUUID().toString(); tbl_orderitemId = tbl_orderitemId.replaceAll("-", ""); panelLines.get(i).setTbl_orderId(tbl_orderitemId); panelLines.get(i).setKotid(kotTicket); panelLines.get(i).setKotdate(m_oTicket.getDate()); panelLines.get(i).setKottable(m_oTicket.getPlaceId()); panelLines.get(i).setKotuser(m_oTicket.getUser().getId()); panelNonKotLines.add(panelLines.get(i)); } } //Method is used for print the non kot lines printRetailKotTicket("Printer.Kot", m_oTicket, panelNonKotLines, m_oTicketExt, printerInfo, kotTicket, floorName); Runtime.getRuntime().gc(); } }