This code demonstrates the alteration of Invoice Printing format

Discussion in 'Free Source Codes' started by rayees, Dec 6, 2013.

    
?

Code is helpful for alteration of Invoice Printing format??

Poll closed Mar 16, 2014.
  1. Great code very helping

    50.0%
  2. just a simple code

    50.0%
  3. not working

    0 vote(s)
    0.0%
  1. rayees

    rayees New Member


    /*
    Objective(s) -
    - This code demonstrates the alteration of Invoice Printing format
    - Default Invoice Format is overridden with a New Format
    */

    [#Form: Comprehensive Invoice]

    ;;option attribute contains the form name with logical condition
    ;;optional forms will execute if the condition is trure

    Option: Global Invoice : @@IsSales ;;;@@IsSales is a system formula. System formula can be defined once and can be reused

    [#Form: Simple Printed Invoice]

    Option: Global Invoice : @@IsSales

    [!Form : Global Invoice]

    ;;By default Form Global Invoice inherit all the details of simple printed invoice hence delete is used to remove the existing parts
    ;;of simple printed invoice

    Delete : Parts
    Delete : Bottom Parts
    Delete : PageBreak

    ;;Formatting the form

    Space Bottom: 0
    Space Left : 0.25 inch
    Space Right : 0

    ;;Addtion of new parts in the form

    Add : Parts : Global Invoice Top Part
    Add : Parts : Global Invoice Body Part
    Add : Bottom Parts : Global Invoice Bottom Part

    [Part: Global Invoice Top Part]

    Lines : Global CmpName, Global VCHDate, Global PartyName, Global PartyAdd1, +
    Global ColumnTitles

    ;;Repeat attribute is used to display address in multi lines. It report on collection partyaddress

    Repeat : Global PartyAdd1 : PartyAddress

    [Line: Global CmpName]

    Fields : Global CmpName

    [Field: Global CmpName]

    Use : Name Field
    Set as : @@CMPMailNAme ;;;setting the company name using system formula
    FullWidth : Yes
    Align : Centre

    [Line: Global VCHDate]

    Fields : Short Prompt, Global VCHDate
    Right Fields: Simple Prompt, Global VCHNo

    ;;In line itself the field can be defined with default values using the below syntax

    Local: Field: Short Prompt : Set as : "Voucher Date : "
    Local: Field: Simple Prompt : Set as : "Voucher No : "

    [Field: Global VCHDate]

    Use : Short Date Field
    Set as : $Date ;;setting the date storage value to a field

    [Field: Global VCHNo]

    Use : Short Name Field
    Set as : $VoucherNumber ;;setting the voucher number storage value

    [Line: Global PartyName]

    Fields : Short Prompt, Global PartyName
    Local: Field: Short Prompt : Set as : "Party Name: "

    [Field: Global PartyName]

    Use : Name Field
    Set as : $PartyLedgerName ;;setting the party ledger name value to the field

    [Line: Global PartyAdd1]

    Fields : Global PartyAdd1

    [Field: Global PartyAdd1]

    Use : Name Field
    Set as : $Address
    Indent : 10

    [Line: Global Column Titles]

    Use : IE Details
    Local: Field: Default : Lines : 2
    Local: Field: Default : Type : String
    Local: Field: Default : Style : Normal Bold
    Local: Field: IE SrNo : Set as : "Sr No"
    Local: Field: IE SiName : Set as : "Name"
    Local: Field: IE Qty : Set as : "Billed Qty"
    Local: Field: IE Rate : Set as : "Rate"
    Local: Field: IE Discount : Set as : "Disc Amt"
    Local: Field: IE Amount : Set as : "Amount"

    ;;Border attribute is used to provide border to the lines
    Border : Column Titles

    [Part: Global Invoice Body Part]

    ;;Two parts are defined inside a part

    Parts : IE Details, LE Details

    ;;vertical attribute is used to allign the parts vertically

    Vertical : Yes

    ;;Scroll attribute is used to make the lines scroll vertically

    Scroll : Vertical
    Common Border: Yes

    [Part: IE Details]

    Lines : IE Details
    Repeat : IE Details : Inventory Entries
    Total : IE Qty, IE Discount, IE Amount

    [Line: IE Details]

    Fields : IE SrNo, IE SiName
    Right Fields : IE Qty, IE Rate, IE Discount, IE Amount
    Explode : Item Desc : $$NumItems:UserDescription > 0 ;;;$$NumItems is a used defned functions which can be
    ;;;used for counting purposes. It takes collection name as parameter

    [Part: Item Desc]

    Lines : Item Desc
    Repeat : Item Desc : UserDescription

    [Line: Item Desc]

    Fields : Item Desc

    [Field: Item Desc]

    Use : Name Field
    Width : 40
    Indent : 8
    Set as : $UserDescription
    Style : Normal Italic

    [Field: IE SrNo]

    Use : Short Name Field
    Set as : $$Line
    Border : Thin Left
    Width : 4

    [Field: IE SIName]

    Use : Name Field
    Set as : $StockItemName
    Border : Thin Left
    FullWIdth : Yes

    [Field: IE Qty]

    Use : Number Field
    Set as : $BilledQty
    Border : Thin Left
    Format : "NoSymbol"
    Align : Right

    [Field: IE Rate]

    Use : Rate Price Field
    Set as : $Rate
    Border : Thin Left

    [Field: IE Discount]

    Use : Amount Forex Field ;;; field will display amount in foreign currency also
    Set as : $$AsAmount:$Discount ;;; Predefined function AsAmount will set discount value in amount format
    Border : Thin Left

    [Field: IE Amount]

    Use : Amount Field ;;;Field will display amount value
    Set as : $Amount
    Border : Thin Left Right
    Format : "NoComma, NoZero"

    [Part: LE Details]

    Lines : LE Details
    Repeat : LE Details : Ledger Entries
    Scroll : Vertical

    [Line: LE Details]

    Use : IE Details
    Local: Field: IE SrNo : Set as : ""
    Local: Field: IE SiName : Set as : $LedgerName
    Local: Field: IE Qty : Set as : ""
    Local: Field: IE Rate : Set as : $$String:$RateOfInvoiceTax + "%" ;;function $$String used for conversion
    Local: Field: IE Amount : Set as : $Amount
    Local: Field: IE SiName : Align : Right
    Local: Field: IE Qty : Format : "NoZero"
    Local: Field: IE Rate : Inactive : $RateOfInvoiceTax = 0
    Local: Field: IE Rate : Type : String
    Remove if : $LedgerName = $PartyLedgerName

    ;; Empty attribute is used to avoid printing of party ledger name in the invoice

    [Part: Global Invoice Bottom Part]

    Lines : Global Total Line, Global AmtInWords, Global ForCmp, Global AuthSign

    [Line: Global Total Line]

    Use : IE Details
    Local: Field: Default : Style : Normal Bold
    Local: Field: IE SrNo : Set as : ""
    Local: Field: IE SiName : Set as : "Totals"
    Local: Field: IE Qty : Set as : $$Total:IEQty ;;funtion total is used to take total of a particular field, here(IEQty)
    Local: Field: IE Rate : Set as : ""
    Local: Field: IE Discount : Set as : $$Total:IEDiscount
    Local: Field: IE Amount : Set as : $$Total:IEAmount
    Border : Totals

    [Line: Global AmtInWords]

    Fields : Short Prompt, Global AmtInWords
    Local: Field: Short Prompt : Set as : "Amount in words : "

    [Field: Global AmtInWords]

    Use : Name Field
    Set as : $$InWords:$Amount + " Only" ;;;Inwords function is used to convert neumaric value into words
    FullWidth : Yes
    Style : Small

    [Line: Global ForCmp]

    Right Fields: Global ForCmp

    [Field: Global ForCmp]

    Use : Name Field
    Set as : "For " + @@CMPMailNAme
    Align : Right
    Width : 0

    [Line: Global AuthSign]

    Right Fields: Global AuthSign
    Space Top : 2

    [Field: Global AuthSign]

    Use : Name Field
    Set as : "Authorised Signatory"
    Width : 0
    Align : Right

    ;; End-of-File
     


Share This Page