You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Branden Strickland <op...@gmail.com> on 2008/06/26 23:47:56 UTC

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!

RE: POS - receipt template question

Posted by Christopher L <cl...@hotmail.com>.
Heh.  I thought that would help you out.  It might be worth it to go through the whole tutorial.  I haven't seen that one before, but what I read of it is very crisp and clear.  After that, I'd highly suggest reading the book "Design Patterns" by the Gang of Four.The java tutorial will give you the "how" of java.  "Design Patterns" will give you the "why".With an understanding of mechanics and design, you can be highly effective.My 2c.C> Date: Fri, 27 Jun 2008 10:14:46 -0400> From: openforbusinessman@gmail.com> To: user@ofbiz.apache.org> Subject: Re: POS - receipt template question> > EPIPHANY!!!!> > Thats how that shit works?!?!?! OMG it all makes so much more sense now!  I> mean I could always look at methods and make then do what I needed them to,> but to understand the logic, and the reason you can name several methods the> same, as long as they pass different types of data..... holy shit.> > You made my day Chris.> > Thanks!> > P.S.  It builds now, I just gotta see if it prints the right receipt later!> > > On Thu, Jun 26, 2008 at 7:38 PM, Christopher L <cl...@hotmail.com>> wrote:> > > You are correct.  Read these and try again.  :)> >> > http://java.sun.com/docs/books/tutorial/java/javaOO/methods.html> > http://java.sun.com/docs/books/tutorial/java/javaOO/arguments.html> >> > C> >> > > Date: Thu, 26 Jun 2008 18:40:09 -0400> > > From: openforbusinessman@gmail.com> > > To: user@ofbiz.apache.org> > > Subject: Re: POS - receipt template question> > >> > > Yah I just saw that....Took me a while to understand the whole boolean> > > thing!> > >> > > Thanks!> > >> > > I changed it a bit...(don't laugh at this)> > >> > > I set a "call?" in save sale (my save and print button) do simply do> > this:> > > DeviceLoader.receipt.printPrep(m_trans);> > >> > > I imported the right things, and this did work when it was> > "printReceipt".> > > It would just bark becuase it didn't have a barcode to print yet..but it> > > still printed.> > >> > > Then in Receipt.java I have this:> > > protected String[] prepReceiptTmpl = null;> > >> > >  public void printPrep(PosTransaction trans) {> > >         Debug.log("Print Receipt Requested : " +> > trans.getTransactionId(),> > > module);> > >         POSPrinter printer = (POSPrinter) control;> > >         this.lastTransaction = trans;> > > ===========AND=============> > >         try {> > >             if (!checkState(printer)) {> > >                 return;> > >             }> > >         } catch (JposException e) {> > >             Debug.logError(e, module);> > >         }> > >> > >         String[] prepReceipt = this.readPrepTemplate();> > >         //this.printPrep(trans, prepReceipt, 0, null);> > >         this.printPrep(trans, prepReceipt, 3, null);> > >     }> > > ==================AND===========> > >  private synchronized String[] readPrepTemplate() {> > >         if (this.prepReceiptTmpl == null) {> > >             this.prepReceiptTmpl = new String[7];> > >             this.readTemplate(prepReceiptTmpl, "prepreceipt.txt", 3);> > >         }> > >> > >         return this.prepReceiptTmpl;> > >     }> > >> > > and I get this error at compile:> > >> > > [javac]> > >> > /ofbiz/ofbizmamas/specialpurpose/pos/src/org/ofbiz/pos/device/impl/Receipt.java:198:> > > printPrep(org.ofbiz.pos.PosTransaction) in> > org.ofbiz.pos.device.impl.Receipt> > > cannot be applied to> > > (org.ofbiz.pos.PosTransaction,java.lang.String[],int,<nulltype>)> > >     [javac]         this.printPrep(trans, prepReceipt, 3, null);> > >> > >> > > I know it's syntax and my inability to know what to pass and where....but> > > any help would be fantastic.> > >> > > Thanks... I know your busy, so I'll wait patiently!> > >> > > Ta-Ta!> > > On Thu, Jun 26, 2008 at 6:26 PM, Christopher L <cl...@hotmail.com>> > > wrote:> > >> > > > 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: openforbusinessman@gmail.com> > > > > To: user@ofbiz.apache.org> > > > > 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!> > > >> >

RE: POS - receipt template question

Posted by Christopher L <cl...@hotmail.com>.
(Resent because of bad formatting)

Heh.  I thought that would help you out.  It might be worth it to go through the whole tutorial.  I haven't seen that one before, but what I read of it is very crisp and clear.  After that, I'd highly suggest reading the book "Design Patterns" by the Gang of Four.

The java tutorial will give you the "how" of java.  "Design Patterns" will give you the "why".

With an understanding of mechanics and design, you can be highly effective.

My 2c.

C

> Date: Fri, 27 Jun 2008 10:14:46 -0400
> From: openforbusinessman@gmail.com
> To: user@ofbiz.apache.org
> Subject: Re: POS - receipt template question
> 
> EPIPHANY!!!!
> 
> Thats how that shit works?!?!?! OMG it all makes so much more sense now!  I
> mean I could always look at methods and make then do what I needed them to,
> but to understand the logic, and the reason you can name several methods the
> same, as long as they pass different types of data..... holy shit.
> 
> You made my day Chris.
> 
> Thanks!
> 
> P.S.  It builds now, I just gotta see if it prints the right receipt later!
> 
> 
> On Thu, Jun 26, 2008 at 7:38 PM, Christopher L <cl...@hotmail.com>
> wrote:
> 
> > You are correct.  Read these and try again.  :)
> >
> > http://java.sun.com/docs/books/tutorial/java/javaOO/methods.html
> > http://java.sun.com/docs/books/tutorial/java/javaOO/arguments.html
> >
> > C
> >
> > > Date: Thu, 26 Jun 2008 18:40:09 -0400
> > > From: openforbusinessman@gmail.com
> > > To: user@ofbiz.apache.org
> > > Subject: Re: POS - receipt template question
> > >
> > > Yah I just saw that....Took me a while to understand the whole boolean
> > > thing!
> > >
> > > Thanks!
> > >
> > > I changed it a bit...(don't laugh at this)
> > >
> > > I set a "call?" in save sale (my save and print button) do simply do
> > this:
> > > DeviceLoader.receipt.printPrep(m_trans);
> > >
> > > I imported the right things, and this did work when it was
> > "printReceipt".
> > > It would just bark becuase it didn't have a barcode to print yet..but it
> > > still printed.
> > >
> > > Then in Receipt.java I have this:
> > > protected String[] prepReceiptTmpl = null;
> > >
> > >  public void printPrep(PosTransaction trans) {
> > >         Debug.log("Print Receipt Requested : " +
> > trans.getTransactionId(),
> > > module);
> > >         POSPrinter printer = (POSPrinter) control;
> > >         this.lastTransaction = trans;
> > > ===========AND=============
> > >         try {
> > >             if (!checkState(printer)) {
> > >                 return;
> > >             }
> > >         } catch (JposException e) {
> > >             Debug.logError(e, module);
> > >         }
> > >
> > >         String[] prepReceipt = this.readPrepTemplate();
> > >         //this.printPrep(trans, prepReceipt, 0, null);
> > >         this.printPrep(trans, prepReceipt, 3, null);
> > >     }
> > > ==================AND===========
> > >  private synchronized String[] readPrepTemplate() {
> > >         if (this.prepReceiptTmpl == null) {
> > >             this.prepReceiptTmpl = new String[7];
> > >             this.readTemplate(prepReceiptTmpl, "prepreceipt.txt", 3);
> > >         }
> > >
> > >         return this.prepReceiptTmpl;
> > >     }
> > >
> > > and I get this error at compile:
> > >
> > > [javac]
> > >
> > /ofbiz/ofbizmamas/specialpurpose/pos/src/org/ofbiz/pos/device/impl/Receipt.java:198:
> > > printPrep(org.ofbiz.pos.PosTransaction) in
> > org.ofbiz.pos.device.impl.Receipt
> > > cannot be applied to
> > > (org.ofbiz.pos.PosTransaction,java.lang.String[],int,<nulltype>)
> > >     [javac]         this.printPrep(trans, prepReceipt, 3, null);
> > >
> > >
> > > I know it's syntax and my inability to know what to pass and where....but
> > > any help would be fantastic.
> > >
> > > Thanks... I know your busy, so I'll wait patiently!
> > >
> > > Ta-Ta!
> > > On Thu, Jun 26, 2008 at 6:26 PM, Christopher L <cl...@hotmail.com>
> > > wrote:
> > >
> > > > 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: openforbusinessman@gmail.com
> > > > > To: user@ofbiz.apache.org
> > > > > 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!
> > > >
> >

Re: POS - receipt template question

Posted by Branden Strickland <op...@gmail.com>.
EPIPHANY!!!!

Thats how that shit works?!?!?! OMG it all makes so much more sense now!  I
mean I could always look at methods and make then do what I needed them to,
but to understand the logic, and the reason you can name several methods the
same, as long as they pass different types of data..... holy shit.

You made my day Chris.

Thanks!

P.S.  It builds now, I just gotta see if it prints the right receipt later!


On Thu, Jun 26, 2008 at 7:38 PM, Christopher L <cl...@hotmail.com>
wrote:

> You are correct.  Read these and try again.  :)
>
> http://java.sun.com/docs/books/tutorial/java/javaOO/methods.html
> http://java.sun.com/docs/books/tutorial/java/javaOO/arguments.html
>
> C
>
> > Date: Thu, 26 Jun 2008 18:40:09 -0400
> > From: openforbusinessman@gmail.com
> > To: user@ofbiz.apache.org
> > Subject: Re: POS - receipt template question
> >
> > Yah I just saw that....Took me a while to understand the whole boolean
> > thing!
> >
> > Thanks!
> >
> > I changed it a bit...(don't laugh at this)
> >
> > I set a "call?" in save sale (my save and print button) do simply do
> this:
> > DeviceLoader.receipt.printPrep(m_trans);
> >
> > I imported the right things, and this did work when it was
> "printReceipt".
> > It would just bark becuase it didn't have a barcode to print yet..but it
> > still printed.
> >
> > Then in Receipt.java I have this:
> > protected String[] prepReceiptTmpl = null;
> >
> >  public void printPrep(PosTransaction trans) {
> >         Debug.log("Print Receipt Requested : " +
> trans.getTransactionId(),
> > module);
> >         POSPrinter printer = (POSPrinter) control;
> >         this.lastTransaction = trans;
> > ===========AND=============
> >         try {
> >             if (!checkState(printer)) {
> >                 return;
> >             }
> >         } catch (JposException e) {
> >             Debug.logError(e, module);
> >         }
> >
> >         String[] prepReceipt = this.readPrepTemplate();
> >         //this.printPrep(trans, prepReceipt, 0, null);
> >         this.printPrep(trans, prepReceipt, 3, null);
> >     }
> > ==================AND===========
> >  private synchronized String[] readPrepTemplate() {
> >         if (this.prepReceiptTmpl == null) {
> >             this.prepReceiptTmpl = new String[7];
> >             this.readTemplate(prepReceiptTmpl, "prepreceipt.txt", 3);
> >         }
> >
> >         return this.prepReceiptTmpl;
> >     }
> >
> > and I get this error at compile:
> >
> > [javac]
> >
> /ofbiz/ofbizmamas/specialpurpose/pos/src/org/ofbiz/pos/device/impl/Receipt.java:198:
> > printPrep(org.ofbiz.pos.PosTransaction) in
> org.ofbiz.pos.device.impl.Receipt
> > cannot be applied to
> > (org.ofbiz.pos.PosTransaction,java.lang.String[],int,<nulltype>)
> >     [javac]         this.printPrep(trans, prepReceipt, 3, null);
> >
> >
> > I know it's syntax and my inability to know what to pass and where....but
> > any help would be fantastic.
> >
> > Thanks... I know your busy, so I'll wait patiently!
> >
> > Ta-Ta!
> > On Thu, Jun 26, 2008 at 6:26 PM, Christopher L <cl...@hotmail.com>
> > wrote:
> >
> > > 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: openforbusinessman@gmail.com
> > > > To: user@ofbiz.apache.org
> > > > 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!
> > >
>

RE: POS - receipt template question

Posted by Christopher L <cl...@hotmail.com>.
You are correct.  Read these and try again.  :)

http://java.sun.com/docs/books/tutorial/java/javaOO/methods.html
http://java.sun.com/docs/books/tutorial/java/javaOO/arguments.html

C

> Date: Thu, 26 Jun 2008 18:40:09 -0400
> From: openforbusinessman@gmail.com
> To: user@ofbiz.apache.org
> Subject: Re: POS - receipt template question
> 
> Yah I just saw that....Took me a while to understand the whole boolean
> thing!
> 
> Thanks!
> 
> I changed it a bit...(don't laugh at this)
> 
> I set a "call?" in save sale (my save and print button) do simply do this:
> DeviceLoader.receipt.printPrep(m_trans);
> 
> I imported the right things, and this did work when it was "printReceipt".
> It would just bark becuase it didn't have a barcode to print yet..but it
> still printed.
> 
> Then in Receipt.java I have this:
> protected String[] prepReceiptTmpl = null;
> 
>  public void printPrep(PosTransaction trans) {
>         Debug.log("Print Receipt Requested : " + trans.getTransactionId(),
> module);
>         POSPrinter printer = (POSPrinter) control;
>         this.lastTransaction = trans;
> ===========AND=============
>         try {
>             if (!checkState(printer)) {
>                 return;
>             }
>         } catch (JposException e) {
>             Debug.logError(e, module);
>         }
> 
>         String[] prepReceipt = this.readPrepTemplate();
>         //this.printPrep(trans, prepReceipt, 0, null);
>         this.printPrep(trans, prepReceipt, 3, null);
>     }
> ==================AND===========
>  private synchronized String[] readPrepTemplate() {
>         if (this.prepReceiptTmpl == null) {
>             this.prepReceiptTmpl = new String[7];
>             this.readTemplate(prepReceiptTmpl, "prepreceipt.txt", 3);
>         }
> 
>         return this.prepReceiptTmpl;
>     }
> 
> and I get this error at compile:
> 
> [javac]
> /ofbiz/ofbizmamas/specialpurpose/pos/src/org/ofbiz/pos/device/impl/Receipt.java:198:
> printPrep(org.ofbiz.pos.PosTransaction) in org.ofbiz.pos.device.impl.Receipt
> cannot be applied to
> (org.ofbiz.pos.PosTransaction,java.lang.String[],int,<nulltype>)
>     [javac]         this.printPrep(trans, prepReceipt, 3, null);
> 
> 
> I know it's syntax and my inability to know what to pass and where....but
> any help would be fantastic.
> 
> Thanks... I know your busy, so I'll wait patiently!
> 
> Ta-Ta!
> On Thu, Jun 26, 2008 at 6:26 PM, Christopher L <cl...@hotmail.com>
> wrote:
> 
> > 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: openforbusinessman@gmail.com
> > > To: user@ofbiz.apache.org
> > > 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!
> >

Re: POS - receipt template question

Posted by Branden Strickland <op...@gmail.com>.
Yah I just saw that....Took me a while to understand the whole boolean
thing!

Thanks!

I changed it a bit...(don't laugh at this)

I set a "call?" in save sale (my save and print button) do simply do this:
DeviceLoader.receipt.printPrep(m_trans);

I imported the right things, and this did work when it was "printReceipt".
It would just bark becuase it didn't have a barcode to print yet..but it
still printed.

Then in Receipt.java I have this:
protected String[] prepReceiptTmpl = null;

 public void printPrep(PosTransaction trans) {
        Debug.log("Print Receipt Requested : " + trans.getTransactionId(),
module);
        POSPrinter printer = (POSPrinter) control;
        this.lastTransaction = trans;
===========AND=============
        try {
            if (!checkState(printer)) {
                return;
            }
        } catch (JposException e) {
            Debug.logError(e, module);
        }

        String[] prepReceipt = this.readPrepTemplate();
        //this.printPrep(trans, prepReceipt, 0, null);
        this.printPrep(trans, prepReceipt, 3, null);
    }
==================AND===========
 private synchronized String[] readPrepTemplate() {
        if (this.prepReceiptTmpl == null) {
            this.prepReceiptTmpl = new String[7];
            this.readTemplate(prepReceiptTmpl, "prepreceipt.txt", 3);
        }

        return this.prepReceiptTmpl;
    }

and I get this error at compile:

[javac]
/ofbiz/ofbizmamas/specialpurpose/pos/src/org/ofbiz/pos/device/impl/Receipt.java:198:
printPrep(org.ofbiz.pos.PosTransaction) in org.ofbiz.pos.device.impl.Receipt
cannot be applied to
(org.ofbiz.pos.PosTransaction,java.lang.String[],int,<nulltype>)
    [javac]         this.printPrep(trans, prepReceipt, 3, null);


I know it's syntax and my inability to know what to pass and where....but
any help would be fantastic.

Thanks... I know your busy, so I'll wait patiently!

Ta-Ta!
On Thu, Jun 26, 2008 at 6:26 PM, Christopher L <cl...@hotmail.com>
wrote:

> 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: openforbusinessman@gmail.com
> > To: user@ofbiz.apache.org
> > 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!
>

RE: POS - receipt template question

Posted by Christopher L <cl...@hotmail.com>.
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: openforbusinessman@gmail.com
> To: user@ofbiz.apache.org
> 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!