It's passed in the method parameters.
public void printReceipt(PosTransaction trans, boolean printStoreCopy)

C
> Date: Thu, 26 Jun 2008 17:47:56 -0400
> From: [EMAIL PROTECTED]
> To: [email protected]
> Subject: POS - receipt template question
> 
> All,
> 
> How in the devil does Receipt.java know whether or not to print a store copy
> as well, or just the customer copy.
> 
> I see this:
> 
>     public void printReceipt(PosTransaction trans, boolean printStoreCopy) {
>         Debug.log("Print Receipt Requested : " + trans.getTransactionId(),
> module);
>         POSPrinter printer = (POSPrinter) control;
>         this.lastTransaction = trans;
> 
>         try {
>             if (!checkState(printer)) {
>                 return;
>             }
>         } catch (JposException e) {
>             Debug.logError(e, module);
>         }
> 
>         if (printStoreCopy) {
>             String[] storeReceipt = this.readStoreTemplate();
>             int payments = trans.getNumberOfPayments();
>             for (int i = 0; i < payments; i++) {
>                 Map info = trans.getPaymentInfo(i);
>                 if (info.containsKey("cardNumber")) {
>                     this.printReceipt(trans, storeReceipt, 1, info);
>                 }
>                 try {
>                     Thread.sleep(3000);
>                 } catch (Exception e) {
>                 }
>             }
>         }
> 
>         // print the customer receipt
>         String[] custReceipt = this.readCustomerTemplate();
>         this.printReceipt(trans, custReceipt, 0, null);
>     }
> 
> so if (printStoreCopy) is the keystone here... I can see that... but where
> in the H is it passed?!?!?!
> 
> I'd like to have one more template to include the additional info field.
> It's called prepreceipt.txt.  For now, It'll go to the same printer... I'm
> hoping somehow to use the method above, or a close version of it to print to
> the same printer, but using the other template.
> 
> and..... I'm at a loss!
> 
> Thanks!

Reply via email to