ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Report for invoice

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Report for invoice

    Hi,

    I want to print current month price and also last price
    actually I am doing code for create one report according sale invoice.
    therefore I have used so many files.
    as

    c kfff setll fggl
    c kfff reade fggl
    c dow Not %eof(fggl)
    c if %subst(date:5:2)=$month
    c eval price=pecst
    c write xxxx
    c endif
    c kfff reade fggl
    c enddo

    therefore I want to read last one price also .
    so could we use there readp and how can we use???

    plzzzzz help..

    simran

  • #2
    Re: Report for invoice

    Why not convert the date you just read to *iso then do something like this
    Code:
    isodate -= %months(1);
    Not sure how your table is setup...but assuming youmhave some type of item number..
    Chain back with different logical using date and item identifier to get price.

    Or use SQL
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

    Comment


    • #3
      Re: Report for invoice

      Assuming you will be having a Unique combination as key fields and according to your code you are retrieving the Current month price.
      I have small doubt regarding your table, How you are loading the Table, I mean to ask, are you updating the invoice by adding the price of the current month to the existing amount or Creating new record for every month.?

      If you are creating a new record for every month, Hopefully, the last record will points to the current month and last before points to the previous month. In this case you can use SETGT and READP for Reading the Current and Previous Months Price.

      PRADEEP
      Pradeep

      Comment


      • #4
        Re: Report for invoice

        Originally posted by SIMRAN
        c kfff setll fggl
        c kfff reade fggl
        c dow Not %eof(fggl)
        c if %subst(date:5:2)=$month
        c eval price=pecst
        c write xxxx
        c endif
        c kfff reade fggl
        c enddo
        1. If the last price is the price 1 before the current month's, try using Jamie's suggestion and use the built-in function.
        2. If what you require is at the start AND end of the table, you'll have to use your SetLL/ReadE along with a SetGT/ReadPE. It depends on how the data is set up in the file.
        3. Avoid using "$" in variables.
        4. If you're not checking for the SetLL to have been successful, there is no point in writing a SetLL and a ReadE. Use Chain instead.
        5. If possible, start using free format.
        6. If possible, use date variables for dates, so you don't have to hard code it as 5:2 based on a given format (I suspect it is ISO here but not a date variable). What if the format changes in future? You may need to analyse and change the program again.
        â??No bird soars too high if he soars with his own wingsâ?? â?? William Blake

        Comment


        • #5
          Re: Report for invoice

          Ok,

          I have tried all things nd pgm is correctly run.

          thnx for your kind information.

          simran

          Comment


          • #6
            Re: Report for invoice

            please post a sample of what you have created...
            we would love to take a look at it.

            jamie
            All my answers were extracted from the "Big Dummy's Guide to the As400"
            and I take no responsibility for any of them.

            www.code400.com

            Comment


            • #7
              Re: Report for invoice

              Can anybody help me how to calculate a previous date or seven days before date through rpgle.

              Regards,
              Shashi

              Comment


              • #8
                Re: Report for invoice

                Code:
                 date7 = date0 - %days(7);
                Both need to be date variables. If date0 is not, convert it into one using the %date(...) bif.
                â??No bird soars too high if he soars with his own wingsâ?? â?? William Blake

                Comment


                • #9
                  Re: Report for invoice

                  you need to be careful here... because its really only workdays you want.
                  I would look at your holiday file as well as excluding weekends.. to best do this
                  I would recommend you create a procedure.

                  There is date stuff littered throughout the site... I would take a look here to start
                  All my answers were extracted from the "Big Dummy's Guide to the As400"
                  and I take no responsibility for any of them.

                  www.code400.com

                  Comment


                  • #10
                    Re: Report for invoice

                    Ok ..
                    correct.

                    Comment


                    • #11
                      Re: Report for invoice

                      hi,

                      Now new probs...
                      Can you please help me...
                      Actually printer file require so many field as pagewidth is around 290
                      so as we know the pagewidth could be 378 as AS/400 printer file.
                      bt I am not able to understand why it is not create..
                      If I am using (21 23 *UOM )then created .. bt when I am callng this printer file through RPGLE then it shows an error open printer file problem while call rpgle program.
                      PHP Code:
                           A          R DETAIL4                                              
                           A                                       FONT
                      (2304 (*POINTSIZE 03))
                           
                      A            TITEMP        15A      180                           
                           A            PRCE22        12S 2    196                           
                           A                                      EDTWRD
                      ('         0.  ')    
                           
                      A            DATEPO         8A      209                           
                           A            PRCE22O       12S 2    218                           
                           A                                      EDTWRD
                      ('         0.  ')    
                           
                      A            DATEP2         8A      232                           
                           A            RQTY2P        11S 2    242                           
                           A                                      EDTWRD
                      ('        0.  ')     
                           
                      A            PROV_F        13S 2    255                           
                           A                                      EDTWRD
                      ('          0.  ')   
                           
                      A            PROV_T        13S 2    270                            
                           A                                      EDTWRD
                      ('          0.  ')    
                           
                      A                                      SPACEA(001
                      Please help me ........

                      Comment


                      • #12
                        Re: Report for invoice

                        Please post the error from RPG as well as the heading to this printfile.

                        thanks
                        Jamie
                        All my answers were extracted from the "Big Dummy's Guide to the As400"
                        and I take no responsibility for any of them.

                        www.code400.com

                        Comment


                        • #13
                          Re: Report for invoice

                          PHP Code:
                          OVRPRTF    FILE(newpTOFILE(newpv +          
                                       
                          DEVTYPE(*IPDSPAGESIZE(100 320 *ROWCOL
                                       
                          LPI(6CPI(20OVRFLW(90FONT(4407 8) + 
                                       
                          PAGRTT(90
                          and output as below ...
                          overlap of records....

                          S.No. CustCD P/N Quantity PO_Date PO Price OLDPODT Price Sale_Value Prov_Val Forg P/N Priceforg Date Old_Price Date Req_Qty Turn P/N Price D
                          1 051457983 46.0 01/07/10 429.15 15/05/10 419.63 .00 .00
                          46.0 051097381 15/03/11 134.3215/02/11 132.21 46.0 051457982 01/0

                          Comment

                          Working...
                          X