use of ar.com.ergio.model.FiscalDocumentPrint in project lar_361 by comitsrl.
the class FiscalPrinterClosing method doIt.
@Override
protected String doIt() throws Exception {
String msg = String.format("CloseType=%s FiscalPrinter=%d", closeType, lar_Fiscal_Printer_ID);
log.info(msg);
try {
final FiscalDocumentPrint fdp = new FiscalDocumentPrint(lar_Fiscal_Printer_ID);
fdp.addDocumentPrintListener(infoFiscalPrinter);
fdp.setPrinterEventListener(infoFiscalPrinter);
infoFiscalPrinter.setFiscalDocumentPrint(fdp);
currentAction = new FiscalCloseAction(null, closeType, lar_Fiscal_Printer_ID);
executeAction();
} catch (Exception e) {
log.log(Level.SEVERE, e.getLocalizedMessage(), e);
}
return resultMsg;
}
use of ar.com.ergio.model.FiscalDocumentPrint in project lar_361 by comitsrl.
the class PosBasePanel method printFiscalTicket.
protected boolean printFiscalTicket(final PO document) {
log.info("Printing fiscal ticket for " + document);
final SwingWorker worker = new SwingWorker() {
@Override
public Object construct() {
boolean success = true;
int c_DocType_ID = document.get_ValueAsInt("C_DocType_ID");
try {
final MDocType docType = new MDocType(m_ctx, c_DocType_ID, null);
int lar_Fiscal_Printer_ID = docType.get_ValueAsInt("LAR_Fiscal_Printer_ID");
log.info("doc type asociated " + docType);
final FiscalDocumentPrint fdp = new FiscalDocumentPrint(lar_Fiscal_Printer_ID, infoFiscalPrinter, infoFiscalPrinter);
log.info("fiscal document print created: " + fdp);
infoFiscalPrinter.setFiscalDocumentPrint(fdp);
success = printDocument(fdp, document);
} catch (Exception e) {
log.log(Level.SEVERE, "Fiscal printing error", e);
success = false;
}
return Boolean.valueOf(success);
}
@Override
public void finished() {
boolean result = (Boolean) getValue();
log.info("Finish fiscal printing thread. Printed Ok?: " + result);
if (result) {
newOrder();
}
}
};
worker.start();
// Thread stops here until fiscal printing finished
infoFiscalPrinter.setVisible(true);
return (Boolean) worker.get();
}
use of ar.com.ergio.model.FiscalDocumentPrint in project lar_361 by comitsrl.
the class FiscalDocumentPrintManager method print.
/**
*/
public boolean print() {
final SwingWorker worker = new SwingWorker() {
@Override
public Object construct() {
boolean success = false;
{
try {
final MDocType docType = new MDocType(document.getCtx(), document.get_ValueAsInt("C_DocType_ID"), document.get_TrxName());
int lar_Fiscal_Printer_ID = docType.get_ValueAsInt("LAR_Fiscal_Printer_ID");
final FiscalDocumentPrint fdp = new FiscalDocumentPrint(lar_Fiscal_Printer_ID, infoFiscalPrinter, infoFiscalPrinter);
log.info("fiscal document print created: " + fdp);
infoFiscalPrinter.setFiscalDocumentPrint(fdp);
success = printDocument(fdp);
} catch (Exception e) {
log.log(Level.SEVERE, "Error en la Impresi\u00f3n Fiscal", e);
success = false;
}
}
return Boolean.valueOf(success);
}
@Override
public void finished() {
boolean result = (Boolean) getValue();
log.info("Finaliza impresi\u00f3n fiscal. Impreso correctamente?: " + result);
}
};
worker.start();
// Thread stops here until fiscal printing finished
infoFiscalPrinter.setVisible(true);
return (Boolean) worker.get();
}
Aggregations