sugar pdf

Hi All Developers,

i am using sugar pdf to make invoice, i use only html language, i want to show invoice amount in words, means if the total amount of invoice suppose 150.00 so i want in field  " one hundred and fifty"

can you have any suggestion or solution, 

thanks in advance

Parents
  • You can change numbers to words in PHP:

    $a = new NumberFormatter("en", NumberFormatter::SPELLOUT);
    $letter_amount = $a->format(152345);

    will give $letter_amount the value: "one hundred fifty-two thousand three hundred forty-five"

    But I don't think there is a way to use that directly in your PDF template.

    So, I would add a read-only text field in the module (you don't need to display it in the view if you don't want to) and add a before save logic hook that populates that field with the value returned by the format function above.

    Then use that new text field in your PDF.

    Maybe someone else has a better solution?

    FrancescaS 

Reply
  • You can change numbers to words in PHP:

    $a = new NumberFormatter("en", NumberFormatter::SPELLOUT);
    $letter_amount = $a->format(152345);

    will give $letter_amount the value: "one hundred fifty-two thousand three hundred forty-five"

    But I don't think there is a way to use that directly in your PDF template.

    So, I would add a read-only text field in the module (you don't need to display it in the view if you don't want to) and add a before save logic hook that populates that field with the value returned by the format function above.

    Then use that new text field in your PDF.

    Maybe someone else has a better solution?

    FrancescaS 

Children