[Vtigercrm-developers] Did anybody work on PDFMaker custom function?

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

[Vtigercrm-developers] Did anybody work on PDFMaker custom function?

kiran
Hi,

I'm working on PurchaseOrder module due to one particular scenario i would have to skip few of the line item products to PDF. So i tried to write Custom function for that but i need help on getting the line item products into the custom and formatting them like a table and giving it to the pdf?

If anyone have already worked on that please help me.

Thanks & Regards.
Reply | Threaded
Open this post in threaded view
|

Re: Did anybody work on PDFMaker custom function?

Alan Lord (News)
On 07/09/16 11:11, kiran wrote:
> Hi,
>
> I'm working on PurchaseOrder module due to one particular scenario i would
> have to skip few of the line item products to PDF. So i tried to write
> Custom function for that but i need help on getting the line item products
> into the custom and formatting them like a table and giving it to the pdf?
>
> If anyone have already worked on that please help me.

I have written quite a few custom functions for PDFMaker and recently I
needed to do something with line items.

There was no particular problem with accessing the visible data from
each line but I did discover that I couldn't get the unique ID of each
line item (lineitem_id in vtiger_inventoryproductrel) which was a shame.

I ended up doing something different but the guys at IT Solutions said
they "would look into it".


HTH

Al


_______________________________________________
http://www.vtiger.com/
Reply | Threaded
Open this post in threaded view
|

Re: Did anybody work on PDFMaker custom function?

its4you
Hi Alan,

in Customfunction you can get what you need (SELECT lineitem_id FROM
vtiger_inventoryproductrel) is no problem. What I remember we have an
issue that one Custom relation to SO module was converted as "name" not
Record ID and your Customfunction was waiting for ID which was not found
with one Update.But generally in Customfunction there is no problem get
what you need. It's your own code.

Matus.

Dňa 7. 9. 2016 o 12:31 Alan Lord napísal(a):

> On 07/09/16 11:11, kiran wrote:
>> Hi,
>>
>> I'm working on PurchaseOrder module due to one particular scenario i
>> would
>> have to skip few of the line item products to PDF. So i tried to write
>> Custom function for that but i need help on getting the line item
>> products
>> into the custom and formatting them like a table and giving it to the
>> pdf?
>>
>> If anyone have already worked on that please help me.
>
> I have written quite a few custom functions for PDFMaker and recently I
> needed to do something with line items.
>
> There was no particular problem with accessing the visible data from
> each line but I did discover that I couldn't get the unique ID of each
> line item (lineitem_id in vtiger_inventoryproductrel) which was a shame.
>
> I ended up doing something different but the guys at IT Solutions said
> they "would look into it".
>
>
> HTH
>
> Al
>
>
> _______________________________________________
> http://www.vtiger.com/
>


_______________________________________________
http://www.vtiger.com/
Reply | Threaded
Open this post in threaded view
|

Re: Did anybody work on PDFMaker custom function?

Alan Lord (News)
On 07/09/16 12:17, IT-Solutions4You wrote:
 > Hi Alan,
 >
 > in Customfunction you can get what you need (SELECT lineitem_id FROM
 > vtiger_inventoryproductrel) is no problem.

Err... That's easy to say, but what is the correct "WHERE" clause for
that query? I would need to supply several different parameters and even
then it is not _guaranteed_ to be the right line?

For each row in vtiger_inventoryproductrel:

"id" is not unique, productid is not unique, sequence_no is not unique,
quantity is not unique, I could go on ;-)

The only definitely unique column (or aggregate of columns) in that
table is the lineitem_id...

 > issue that one Custom relation to SO module was converted as "name" not
 > Record ID and your Customfunction was waiting for ID which was not found
 > with one Update.But generally in Customfunction there is no problem get
 > what you need. It's your own code.

That's not something I remember discussing.

Thanks

Al

_______________________________________________
http://www.vtiger.com/
Reply | Threaded
Open this post in threaded view
|

Re: Did anybody work on PDFMaker custom function?

its4you
I mean build whole Productblock table with Customfunction. Instead of

header_colmuns
# PRODUCTBLOC_START #
columns [Your custom function with lineitem_id]
# PRODUCTBLOC_END #

create a function which return whole table

[Your Product block customfunction]

Matus.



Dňa 7. 9. 2016 o 13:44 Alan Lord napísal(a):

> On 07/09/16 12:17, IT-Solutions4You wrote:
>> Hi Alan,
>>
>> in Customfunction you can get what you need (SELECT lineitem_id FROM
>> vtiger_inventoryproductrel) is no problem.
>
> Err... That's easy to say, but what is the correct "WHERE" clause for
> that query? I would need to supply several different parameters and even
> then it is not _guaranteed_ to be the right line?
>
> For each row in vtiger_inventoryproductrel:
>
> "id" is not unique, productid is not unique, sequence_no is not unique,
> quantity is not unique, I could go on ;-)
>
> The only definitely unique column (or aggregate of columns) in that
> table is the lineitem_id...
>
>> issue that one Custom relation to SO module was converted as "name" not
>> Record ID and your Customfunction was waiting for ID which was not found
>> with one Update.But generally in Customfunction there is no problem get
>> what you need. It's your own code.
>
> That's not something I remember discussing.
>
> Thanks
>
> Al
>
> _______________________________________________
> http://www.vtiger.com/
>


_______________________________________________
http://www.vtiger.com/
Reply | Threaded
Open this post in threaded view
|

Re: Did anybody work on PDFMaker custom function?

kiran
This post was updated on .
Yes we can create a table with static fields and can return using custom function. But here is the tricky one, can we populate the rows dynamically?
Reply | Threaded
Open this post in threaded view
|

Re: Did anybody work on PDFMaker custom function?

its4you
Yes, of course. You can return <table> .... </table>. You don't need
start <html> because it's already started with pdf template .

Matus.

Dňa 7. 9. 2016 o 15:27 kiran napísal(a):

> Is it possible to return a table using custom function?
>
> like this...
>
> return "<html> .. </html>";
>
> and again it won't able to print as a table in document.
>
> Thanks
>
>
>
> --
> View this message in context: http://vtiger-crm.2324883.n4.nabble.com/Vtigercrm-developers-Did-anybody-work-on-PDFMaker-custom-function-tp19780p19787.html
> Sent from the vtigercrm-developers mailing list archive at Nabble.com.
> _______________________________________________
> http://www.vtiger.com/
>


_______________________________________________
http://www.vtiger.com/
Reply | Threaded
Open this post in threaded view
|

Re: Did anybody work on PDFMaker custom function?

kiran
Thanks.

I started implementing feeling great.

Thanks you once again.
Reply | Threaded
Open this post in threaded view
|

Re: Did anybody work on PDFMaker custom function?

kiran
This post was updated on .
In reply to this post by its4you
@Matus.

I have done like this



Here $entityid is purchaseorderid when doing this it is working with purchase order have only one line item. I have tried this with purchase order with multiple line items, but nothing is returning. Can you have any idea where should i have mistaken?

Thanks & Regards
Reply | Threaded
Open this post in threaded view
|

Re: Did anybody work on PDFMaker custom function?

its4you
Hi,

 > $listprice = $row['listprice'];

must be inside

 > for($j=0;$j<count($row);$j++){
 >
 > $loop1 = $loop1.&quot;&lt;td>$listprice";
 >
 > }

otherway you define $listprice only one time from first row.


Matus


Dňa 8. 9. 2016 o 6:14 kiran napísal(a):

> @Matus.
>
> I have done like this
>
> <?php
> global $log;
> if (!function_exists('product_custom')) {
>
>     function product_custom($entityid) {
> $adb = PearDatabase::getInstance();
> $row = $adb->fetchByAssoc($adb->pquery("SELECT listprice FROM
> vtiger_inventoryproductrel WHERE id=?", array($entityid)));
> $listprice = $row['listprice'];
> $f = "
>
>
>
>
> Name
>
> ";
> $start = "
> ";
> for($j=0;$j<count($row);$j++){
>
> $loop1 = $loop1.&quot;&lt;td>$listprice";
>
> }
> $end = "";
> $e = "
> ";
>
>
>         return $f.$start.$loop1.$end.$e;
>     }
> }
>
> Here $entityid is purchaseorderid when doing this it is working with
> purchase order have only one line item. I have tried this with purchase
> order with multiple line items, but nothing is returning. Can you have any
> idea where should i have mistaken?
>
> Thanks & Regards
>
>
>
> --
> View this message in context: http://vtiger-crm.2324883.n4.nabble.com/Vtigercrm-developers-Did-anybody-work-on-PDFMaker-custom-function-tp19780p19790.html
> Sent from the vtigercrm-developers mailing list archive at Nabble.com.
> _______________________________________________
> http://www.vtiger.com/
>


_______________________________________________
http://www.vtiger.com/