Announcement

Collapse
No announcement yet.

Multiline and multipage report

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

  • Multiline and multipage report

    Hi all,
    I've got several problems on trying to print commercial documents like invoices, purchase orders.. and so on.

    1. If you have different lines for an item is not clear how to manage them. For istance it could be that an item has 3 lines and next one 5 lines. PDF Reporting makes overlapping and a real mess. It only manage (it seems to me) only fixed inter line space . So all items are of heigh 3. If you have only a line it take anyway 3 lines.
    Very bad and not possible in a official document.

    2. If document need a multipage what happens. How many lines per page ? If the last item lines for istance overcome the max lenght of page what happens ?

    Thanks
    Giovanni

  • #2
    Hi Giovanni,

    did you find the solution, I'm getting the same issue like you have.
    please let us share your skill, what you did with this situation.

    thanks.
    Website Design

    Comment


    • #3
      Unfortunately not. I'm still waiting for suggestions.

      Comment


      • #4
        Hi,
        there is no easy way in SC. You have solve this by either code it yourself (TCPDF) or use a third party product.
        I use the phpjasperxml class described in detail here http://www.scriptcase.net/forum/show...lookin-reports
        Once you figured it out it's straight forward and the possibilities are almost endless. And the best thing is: Without Java!

        Take care
        jsb

        Comment


        • #5
          Thanks so much for infos. Very interting but it no seems like a walk for my tech skill.
          When I got a little time I will do some test ... and probably I will bag your help ;-))

          Comment


          • #6
            My tips relate to: PDF Report / Settings / Type "Records per line"!

            Originally posted by giovannino View Post
            1. If you have different lines for an item is not clear how to manage them. For istance it could be that an item has 3 lines and next one 5 lines. PDF Reporting makes overlapping and a real mess. It only manage (it seems to me) only fixed inter line space . So all items are of heigh 3. If you have only a line it take anyway 3 lines.
            Use Field / Data Type "Multiple Lines Text" (PDF Report / Fields / <Detail field>). Use Width in that dialog to limit the line length (SC makes a line break). Do not use PDF Report / Layout PDF / Interface / <YourField> / Width. This does not work well -> bug / unlogical.

            Originally posted by giovannino View Post
            2. If document need a multipage what happens. How many lines per page ? If the last item lines for istance overcome the max lenght of page what happens ?
            PDF Report / Settings / Initial Height => start position for detail lines.
            PDF Report / Layout PDF / Interface / Footer / Y Pos => start position for footer and end position for detail lines (if Y Pos detail lines > Y Pos Footer = page break).

            HTH.
            Best regards: - Reinhard -

            I use ScriptCase 8 Enterprise Edition, Version 8.(latest)

            Comment


            • #7
              So if I have data that fills up more than a page with PDF set to Records per page the I'm SOL? I have data that goes past the first page but every line after that is on a new page. Settings like height, page #, others don't do a damn thing. This app type should be removed or improved.

              Comment


              • #8
                Those problems you mention are a little part of all.
                That's why I'm trying to use Jaspersoft Studio instead. I got problems right now on implement it but I hope to be successful in near future (hoping that JSB support me...).
                For single page and easy report (flat lists..) SC could be enough but if you want have commercial document or complex multipage/multilayout reports.. no way out .. you have to choose an alternative.

                Comment


                • #9
                  This thread is over one year old now and most likely refers to ScriptCase v7.

                  I am having the same problem with ScriptCase v8 AND it has moved from fpdf to tcpdf!!!

                  Scriptcase, will a fix be available soon?

                  Comment


                  • #10
                    Originally posted by Garfieldus View Post
                    This thread is over one year old now and most likely refers to ScriptCase v7.

                    I am having the same problem with ScriptCase v8 AND it has moved from fpdf to tcpdf!!!

                    Scriptcase, will a fix be available soon?
                    Hello,

                    I am in contact with our developers and decision managers so we can improve the PDF, but can not guarantee an immediate result, since the implementation has to be great. There are plans to change the Report PDF, but I have no information of when it will be implemented in version.

                    What I can say is that I am in touch with those responsible and we will work in this case.

                    Thank you!
                    Best regards,
                    Thomas Soares.
                    ScriptCase International.

                    Email: t.soares@scriptcase.net
                    Visit our Blog: http://www.scriptcase.net/blog/
                    Visit out fan page: http://www.facebook.com/Scriptcase

                    Comment


                    • #11
                      Originally posted by Thomas Soares View Post
                      Hello,

                      I am in contact with our developers and decision managers so we can improve the PDF, but can not guarantee an immediate result, since the implementation has to be great. There are plans to change the Report PDF, but I have no information of when it will be implemented in version.

                      What I can say is that I am in touch with those responsible and we will work in this case.

                      Thank you!
                      Ok, thank you.

                      It's hand coding for me so!!

                      Comment


                      • #12
                        I have now programmed my own (and correct) multipage report ...

                        When you have one master record and many slave records (for example one invoice with many positions) SC prints this fine (except background image ...).

                        But if you have two or more master records SC prints only the first record but with all slave records ... That is a big crap ... is something not tested?

                        I'am use the following SQL strings:

                        SQL Master: SELECT ... FROM Invoice WHERE InvoiceID IN (1234, 5678) <= eg two (or more) master records
                        SQL Slave for body: SELECT ... FROM InvoiceDetails WHERE InvoiceID = {InvoiceID}
                        Best regards: - Reinhard -

                        I use ScriptCase 8 Enterprise Edition, Version 8.(latest)

                        Comment


                        • #13
                          Originally posted by RHS View Post
                          But if you have two or more master records SC prints only the first record but with all slave records ... That is a big crap ... is something not tested?
                          Yes, that is exactly what is happening to me. Today I started hand coding my own multipage report. This is NOT something I expected to have to do when I bought SC

                          Comment


                          • #14
                            manuality manage multiple pages

                            Code:
                                      /*------------------ Page 1 -----------------*/
                                        sc_pdf_print($cell_folio); //folio of the order
                            
                                        //prin info of the provider
                                        sc_pdf_print_mult($cell_id_provedor, 4.2333333333333);
                                        sc_pdf_print($cell_id_contacto);
                                        sc_pdf_print($cell_fecha_pedido);
                                        sc_pdf_print($cell_id_ot);
                                        sc_pdf_print($cell_proyecto);
                                        sc_pdf_print($cell_credito_dias);
                                        sc_pdf_print($cell_fecha_entrega);
                                        sc_pdf_print_mult($cell_entregar_en, 4.2333333333333);
                                        sc_pdf_print($cell_estaus_odc);
                                        sc_pdf_print($cell_calle);
                                        sc_pdf_print($cell_colonia);
                                        sc_pdf_print($cell_municipio);
                                        sc_pdf_print($cell_telefono);sc_pdf_image('ODC_superior.png',0,0,216);
                                        sc_pdf_set_y(80);
                                        foreach ({compra_detalle} as $NM_ind => $Dados)
                                        { 
                            				$i = sc_pdf_get_y(); //get the "Y" position
                            				$pagina = 0; //assign value to number of page only to manage pages 
                            				if ($i > 245){ //in a letter page if the "Y" position if for research the end of the page create new page
                            					sc_pdf_add_page('P', 'Letter');
                            					sc_pdf_image('ODC_titulo.png',0,0,216); //this put an image of the title of the page, only to look good the image is png whit transparency  
                            					$i = 40; //assign new value to $i
                            					$pagina++; //add one to pagina
                            					sc_pdf_print($cell_folio); 
                            				}
                            				sc_pdf_set_y($i); //assign a value to the "y" position
                                            // print the line of values this is shopping order 
                                            sc_pdf_print_sub_sel($cell_compra_detalle_cpr_odc_detalle_catidad[$NM_ind]);
                                            sc_pdf_print_sub_sel_mult($cell_compra_detalle_unidad[$NM_ind], 3.5277777777778);
                                            sc_pdf_print_sub_sel_mult($cell_compra_detalle_cpr_odc_detalle_des_producto[$NM_ind], 3.5277777777778);
                            				sc_pdf_print_sub_sel($cell_compra_detalle_cpr_odc_detalle_precio_uni[$NM_ind]);
                                            sc_pdf_print_sub_sel($cell_compra_detalle_precio2[$NM_ind]);
                                            $y = sc_pdf_get_y(); //obtain the value of position of "Y"
                            				$h = $y-$i; //calculate the height of the line
                            				$h = $h+23; //sum 23 millimeters  
                            				sc_pdf_rect(4,$i-4,204,$h, 'D'); //draw a rectangle to that line
                            				sc_pdf_set_y($y+23); //set the new "Y" position
                                        }
                            			$j = sc_pdf_get_y();
                            			switch ($pagina){
                            				case 0: //si es la primer pagina //check if it is the firts page
                            					if ($j >= 160){ //if the position is most of 160 millimeter create another page, thas its because the bottom of the order its big and need more espace
                            					sc_pdf_add_page('P', 'Letter');
                            					sc_pdf_image('ODC_titulo.png',0,0,216);					
                            					sc_pdf_print($cell_folio);
                            					} //else do noting
                            					break;
                            				default: //si la pagina no es la primera //if not first page 
                            					if ($j >= 1152){ //check the last Y position
                            					sc_pdf_image('ODC_titulo.png',0,0,216);
                            					sc_pdf_add_page('P', 'Letter');
                            					sc_pdf_print($cell_folio);
                            					sc_pdf_print($cell_folio);
                            					}
                            			}
                            			sc_pdf_image('ODC_inferior.png',0,0,216);		//insert the image of the bottom	png whit transparency
                                                   //print the fields  results
                            			sc_pdf_print($cell_mond);
                                                    sc_pdf_print($cell_one);
                                                    sc_pdf_print($cell_tow);
                            			sc_pdf_print($cell_text);
                            			sc_pdf_print($cell_retencion);
                                                    sc_pdf_print($cell_total);
                            			sc_pdf_print($cell_solicito);
                            This cost me had works and lot of reader fpdf.org documentation and trial and error. its not perfect, but I think its guide in the correct way. IN total uses tree images one its only top, one its only bottom and one its both, for best need other with the info of the bottom but in the top and change the "Y" position of the results depending of value of page valiable.

                            There are the to sql details.
                            Code:
                            CREATE TABLE `cpr_odc` (
                            	`id_odc` INT(5) UNSIGNED NOT NULL AUTO_INCREMENT,
                            	`folio` INT(5) UNSIGNED ZEROFILL NULL DEFAULT NULL,
                            	`id_provedor` INT(5) UNSIGNED NULL DEFAULT NULL,
                            	`id_contacto` INT(5) UNSIGNED NULL DEFAULT NULL,
                            	`fecha_pedido` DATE NOT NULL,
                            	`id_ot` INT(5) NULL DEFAULT NULL,
                            	`proyecto` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8_spanish2_ci',
                            	`credito_dias` INT(4) UNSIGNED NOT NULL DEFAULT '0',
                            	`fecha_entrega` DATE NULL DEFAULT NULL,
                            	`entregar_en` INT(4) UNSIGNED NOT NULL DEFAULT '2',
                            	`estaus_odc` INT(4) UNSIGNED NOT NULL DEFAULT '1',
                            	`id_comprador` INT(5) UNSIGNED NULL DEFAULT '1',
                            	`id_moneda` INT(2) UNSIGNED NOT NULL DEFAULT '1',
                            	PRIMARY KEY (`id_odc`),
                            	INDEX `FK_cpr_odc_cpr_estatus_odc` (`estaus_odc`),
                            	INDEX `id_provedor` (`id_provedor`),
                            	INDEX `entregar_en` (`entregar_en`),
                            	INDEX `id_comprador` (`id_comprador`),
                            	INDEX `id_moneda` (`id_moneda`),
                            	INDEX `id_contacto` (`id_contacto`),
                            	CONSTRAINT `FK_cpr_odc_cpr_estatus_odc` FOREIGN KEY (`estaus_odc`) REFERENCES `cpr_estatus_odc` (`id_estatus_odc`) ON UPDATE NO ACTION ON DELETE NO ACTION
                            )
                            COLLATE='utf8_spanish2_ci'
                            ENGINE=InnoDB;
                            
                            CREATE TABLE `cpr_odc_detalle` (
                            	`id_detalle_odc` INT(6) UNSIGNED NOT NULL AUTO_INCREMENT,
                            	`id_odc` INT(5) UNSIGNED NOT NULL,
                            	`catidad` DOUBLE UNSIGNED NOT NULL,
                            	`unidad` INT(10) UNSIGNED NOT NULL,
                            	`des_producto` TEXT NOT NULL COLLATE 'utf8_spanish2_ci',
                            	`precio_uni` DOUBLE NOT NULL,
                            	`entregados` DOUBLE NULL DEFAULT '0',
                            	`fecha` DATETIME NULL DEFAULT NULL,
                            	`iva` INT(3) UNSIGNED NULL DEFAULT '16',
                            	`one_dim` DOUBLE(7,3) NULL DEFAULT '1.000',
                            	`tow_dim` DOUBLE(7,3) NULL DEFAULT '1.000',
                            	`mat1` INT(5) UNSIGNED NULL DEFAULT NULL,
                            	`mat2` INT(5) UNSIGNED NULL DEFAULT NULL,
                            	`mat3` INT(5) UNSIGNED NULL DEFAULT NULL,
                            	`id_ot` INT(5) UNSIGNED NULL DEFAULT NULL,
                            	PRIMARY KEY (`id_detalle_odc`),
                            	INDEX `FK_cpr_odc_detalle_cpr_unidades` (`unidad`),
                            	INDEX `FK_cpr_odc_detalle_cpr_odc` (`id_odc`),
                            	INDEX `FK_cpr_odc_detalle_alm_mat_clave1` (`mat1`),
                            	INDEX `FK_cpr_odc_detalle_alm_mat_clave2` (`mat2`),
                            	INDEX `FK_cpr_odc_detalle_alm_mat_clave3` (`mat3`)
                            )
                            COLLATE='utf8_spanish2_ci'
                            ENGINE=InnoDB
                            In the pdf it this
                            Code:
                            SELECT 
                                id_odc,
                                folio,
                                id_provedor,
                                id_contacto,
                                fecha_pedido,
                                id_ot,
                                proyecto,
                                credito_dias,
                                fecha_entrega,
                                entregar_en,
                                estaus_odc,
                                id_comprador,
                                id_moneda
                            FROM 
                                cpr_odc
                            WHERE id_odc = [ODC]
                            
                            AND
                            
                            SELECT 
                                catidad,
                                cpr_unidades.nombre_unidad 
                                AS unidad,
                                des_producto,	
                                precio_uni,
                            CASE campos WHEN 3 THEN (catidad * precio_uni) 
                            WHEN 0 THEN (catidad * precio_uni)
                            WHEN 1 THEN (catidad * precio_uni * one_dim)
                            WHEN 2 THEN (catidad * precio_uni * one_dim/100 *tow_dim/100)
                            END AS precio2 FROM cpr_odc_detalle JOIN cpr_unidades
                            ON cpr_odc_detalle.unidad = cpr_unidades.id_unidad
                            WHERE id_odc = {id_odc}
                            THE results its calling from a view create for that but is complicated and only its because the inner need of the company

                            Comment


                            • #15
                              Hello,
                              I did a report PDF using header and body section.
                              The header is standar as SC does while the body I did a customization in order to have single record fields split into several lines.
                              Now I got the problem that the next record page is correct about header but about the body, on second page (2nd record) , it starts NOT correctly as expected.
                              I got a A4 sheet . Need I to add within code something about page lenght or something similar ??
                              Thanks

                              SC created Code commented
                              /*------------------ Page 1 -----------------
                              sc_pdf_print($cell_products_demo_product_code);
                              sc_pdf_print($cell_products_demo_product_desc);
                              sc_pdf_print($cell_demo_booking_Prospect);
                              sc_pdf_print($cell_demo_booking_demo_date);
                              sc_pdf_print($cell_demo_booking_demo_hours);
                              sc_pdf_print($cell_demo_booking_product_demoID);
                              sc_pdf_print($cell_products_demo_note);
                              sc_pdf_print($cell_demo_booking_demo_note);
                              -------------------------------------------*/
                              Custom code

                              sc_pdf_set_left_margin(25);
                              sc_pdf_multi_cell(0,5,{demo_booking_Prospect}."\n" .
                              "Data presentazione: ". {demo_booking_demo_date}." Ore: ".{demo_booking_demo_hours} ."\n\n" .
                              {products_demo_product_code}." ". {products_demo_product_desc} ."\nNote 1:".
                              {products_demo_note}."\nNote 2:".
                              {demo_booking_demo_note} ."\n");

                              Attached Files

                              Comment

                              Working...
                              X