Please correct my code

Discussion in 'Free Source Codes' started by krishnankamalakannan, Jun 28, 2021.

    

  1. I enclosed my txt file for trip settlement. Here how to bring total km and average km. Please correct my code sir. Advance thanks to all experts.
    Kamalakannan
     

    Attached Files:



  2. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    set as : #Trclkmf - #Tropkmf for total kms.....

    For avaerage ....... use same method..........#fieldName / #divisionFLDName
     
    krishnankamalakannan likes this.



  3. Thanks Mr. Kamdar sir for your quick response. I changed as per your advise but still its not working sir.


    [Field : Trtotkm]
    info : "Total Km : "
    align : left
    style : Large

    [Field : Trtotkmf]
    use : Number Field

    set as : #Trclkmf - #Tropkmf
    storage : Trtotkmf
    Width: 15
    Format: "Nozero"



    [Field : Travgt]
    info : "Avg Km : "
    align : left
    style : Large


    [Field : Travgkm]
    use : Amount Field
    set as : #Avgkm1 / #DieLtr
    storage : Avgkm


    upload_2021-6-29_9-44-24.png
     


  4. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    What is #Avgkm1 and #Dieltr ??? which Fieldname is this ??

    put the actual fieldname........
     
    Last edited: Jun 29, 2021


  5. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Capture.PNG

    You need to get the BASICS right first........Have you made this or is it ready made??
     



  6. I learned TDL are go through this forum. But this is done by me only. With your guidence I am learning sir. I go through others coding. But the idea and prepare the code is purely main. I attached the code also. Now the average is workig fine but the total km is now working sir.

    info : "Closing Km: "
    align : left
    style : Large

    [Field : Trclkmf]
    use : Amount Field
    set as : $Trclkmf
    storage : Trclkmf


    [Field : Tropkm]
    info : "Opening Km : "
    align : left
    style : Large

    [Field : Tropkmf]
    use : Amount Field
    set as : $Tropkmf
    storage : Tropkmf

    [Field : Trtotkm]
    info : "Total Km : "
    align : left
    style : Large

    [Field : Trtotkmf]
    use : Amount Field

    set as : #Trclkmf - #Tropkmf
    storage : Trtotkmf
    Width: 15
    Format: "Nozero"
     

    Attached Files:



  7. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Use : Number Field
     


  8. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    average is working fine...but Total km is not... then how will the average work ???
     



  9. Because first closing km is shown in the total km sir. from that the average is calculated and shown as a average sir. Number field is not working sir.
    Another one sir, I subtract from to date - from date I am getting diff but I want in days sir please guide me

    [Field : FromDaf]
    use : Uni Date Field
    set as : $FrDate1
    storage : FrDate1

    [Field : ToDa2]
    info : "To Date : "
    align : left
    style : Large

    [Field : ToDaf2]
    use : Uni Date Field
    set as : $ToDate1
    storage : ToDate1

    [Field : NoDa11]
    info : "No.of Days : "
    align : left
    style : Large

    [Field : NoDaf11]
    use : Uni Date Field
    set as : #ToDaf2 - #FromDaf
    storage : NoDaf11

    upload_2021-6-29_14-48-8.png
     


  10. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    [#Field: VCH Particulars]
    Sub Form : BillDetail : ##SVVoucherType = "Journal" and $LedgerName = "Trip Settlement"
    [#Field: ACLSAmt]
    Set As : if $$NumItems:BAggre > 0 and $LedgerName = "Trip Settlement" then @MyTot else @OldValue
    MyTot : $$CollAmtTotal:BAggre:$BillAmt
    OldValue : $$Value
    [Report: BillDetail] ;; Sub Form
    Form : BillDetail
    Title : $$LocaleString:"Bill Details"
    [Form: BillDetail]
    Parts : Trip Details, Bill Titles, Bill Details
    Background : White, Lily White
    Height : 70% Screen
    Width : 70% Screen
    [Part: Trip Details]
    Lines : Lineft1, Trip1 Details,Lineft2, TripDat, Lineft3, Tripkm, Lineff, Lineft4,Tripexp, Tripexp1
    [Line : Lineft1]
    field : Llin1
    [Field : Llin1]
    Set as : "Settlement Details"
    Skip : Yes
    FullWidth : Yes
    Align : Centre
    Border : Thin Bottom
    Style : "Normal Bold"

    [Line: Trip1 Details]
    Field : Vhnom, Vhnomf, DrName, DrNam, DieTit, DieLt
    [Field : Vhnom]
    info : "Vehicle No : "
    align : left
    style : Large
    [Field : Vhnomf]
    use : Name Field
    ;set as : $Vhnum1
    storage : Vhnum1
    [Field : DrName]
    info : "Driver Name : "
    align : left
    style : Large
    [Field : DrNam]
    use : Name Field
    set as : $Drname
    storage : Drname
    [Field : DieTit]
    info : "Diesel Lts. : "
    align : left
    style : Large
    [Field : DieLt]
    use : Amount Field
    set as : $DieLtr
    storage : DieLtr
    [Line : Lineft2]
    field : Llin2
    [Field : Llin2]
    Skip : Yes
    FullWidth : Yes
    Align : Centre
    Border : Thin Bottom
    Style : "Normal Bold"
    [Line: TripDat]
    Field : FromDa, FromDaf, ToDa2, ToDaf2, NoDa11, NoDaf11
    [Field : FromDa]
    info : "From Date : "
    align : left
    style : Large
    [Field : FromDaf]
    use : Uni Date Field
    set as : $FrDate1
    storage : FrDate1
    [Field : ToDa2]
    info : "To Date : "
    align : left
    style : Large
    [Field : ToDaf2]
    use : Uni Date Field
    set as : $ToDate1
    storage : ToDate1
    [Field : NoDa11]
    info : "No.of Days : "
    align : left
    style : Large
    [Field : NoDaf11]
    use : Number Field
    Set as : #ToDaf2 - #FromDaf
    set always : yes
    ;set as : $NoDay1
    ;storage : NoDay1
    [Line : Lineft3]
    field : Llin3
    [Field : Llin3]
    Skip : Yes
    FullWidth : Yes
    Align : Centre
    Border : Thin Bottom
    Style : "Normal Bold"
    [Line: Tripkm]
    Field : Trclkm, Trclkmf, Tropkm, Tropkmf, Trtotkm, Trtotkmf, Travgt, Travgkm
    [Field : Trclkm]
    info : "Closing Km: "
    align : left
    style : Large
    [Field : Trclkmf]
    use : Number Field
    set as : $Trclkm1
    storage : Trclkm1
    Set always : yes
    [Field : Tropkm]
    info : "Opening Km : "
    align : left
    style : Large
    [Field : Tropkmf]
    use : Number Field
    set as : $Tropkm1
    storage : Tropkm1
    Set always : yes
    [Field : Trtotkm]
    info : "Total Km : "
    align : left
    style : Large
    [Field : Trtotkmf]
    use : Number Field
    ;Local : Field : Number Field : Set As : $Trclkm1 - $Tropkm1
    set as : #Trclkmf - #Tropkmf
    Set always : yes
    storage : Trtotkm1
    Width: 15
    Format: "Nozero"
    [Field : Travgt]
    info : "Avg Km : "
    align : left
    style : Large
    [Field : Travgkm]
    use : Amount Field
    set as : #Trtotkmf / #DieLt
    set always : yes
    storage : Avgkm
    [Line : Lineff]
    field : Llin
    [Field : Llin]
    Skip : Yes
    FullWidth : Yes
    Align : Centre
    Border : Thin Bottom
    Style : "Normal Bold"
    [Line : Lineft4]
    field : Llin4
    [Field : Llin4]
    Set as : "Trip Expenses Details"
    Skip : Yes
    FullWidth : Yes
    Align : Centre
    Border : Thin Bottom
    Style : "Normal Bold"
    [Line: Tripexp]
    Field : Trload, Trloadf, Trunload, Trunloadf, Trmool, Trmoolf, Trtoll, Trtollf
    [Field : Trload]
    info : "Loading : "
    align : left
    style : Large
    [Field : Trloadf]
    use : Amount Field
    set as : $Trload1
    storage : Trload1
    [Field : Trunload]
    info : "Unloading : "
    align : left
    style : Large
    [Field : Trunloadf]
    use : Amount Field
    set as : $Trunload1
    storage : Trunload1
    [Field : Trmool]
    info : "Maamool : "
    align : left
    style : Large
    [Field : Trmoolf]
    use : Amount Field
    set as : $Trmool1
    storage : Trmool1
    [Field : Trtoll]
    info : "Tollgate : "
    align : left
    style : Large
    [Field : Trtollf]
    use : Amount Field
    set as : $Tollg1
    storage : Tollg1
    [Line: Tripexp1]
    Field : Drbata, Drbataf, Trwem, Trwemf, Trpc, Trpcf, Trother, Trotherf
    [Field : Drbata]
    info : "Driver Bata : "
    align : left
    style : Large
    [Field : Drbataf]
    use : Amount Field
    set as : $Drbat1
    storage : Drbat1
    [Field : Trwem]
    info : "Weighment : "
    align : left
    style : Large
    [Field : Trwemf]
    use : Amount Field
    set as : $Trwem1
    storage : Trwem1
    [Field : Trpc]
    info : "PC : "
    align : left
    style : Large
    [Field : Trpcf]
    use : Amount Field
    set as : $Trpc1
    storage : Trpc1
    [Field : Trother]
    info : "Others : "
    align : left
    style : Large
    [Field : Trotherf]
    use : Amount Field
    set as : $Othe1
    storage : Othe1
    [system : udf]
    Vhnum1: String : 105
    Drname: String : 106
    DieLtr : Amount : 107
    FrDate1 : Date : 108
    ToDate1 : Date : 109
    Tropkm1 : Number : 110
    Trclkm1 : Number : 111
    Trload1 : Amount : 112
    Trunload1 : Amount : 113
    Trmool1 : Amount : 114
    Tollg1 : Amount : 115
    Drbat1 : Amount : 116
    Trwem1 : Amount : 117
    Trpc1 : Amount : 118
    Othe1 : Amount : 119
    [Part: BillTitles]
    Lines : Bill Details
    [Line: Bill Details]
    Fields : BHeader
    [Field: BHeader]
    Set as : "GC Details For " + $LedgerName
    Skip : Yes
    FullWidth : Yes
    Align : Centre
    Border : Thin Bottom
    Style : "Normal Bold"
    [Part: BillDetails]
    Line : BillDetailsH, BillDetailsD
    Scroll : Vertical
    Repeat : BillDetailsD : BAggre
    Break After : $$Line = 3
    [Line: BillDetailsH]
    Fields : SNo, CustName, BillNoTitle, BillAmt,Tripadv
    Local : Field : Default : Skip : Yes
    Local : Field : Default : Width : 15
    Local : Field : Default : Align : Centre

    [Line: BillDetailsD]
    Fields : SNo1, CustName1, BillNo1, BillAmt1,Tripadv1
    Local : Field : Default : Width : 15
    Local : Field : Default : Align : Centre

    [Field: SNo]
    Set as : "S.No"
    [Field: SNo1]
    Set as : $$Line
    Skip : Yes
    [Field: CustName]
    Set as : "From"
    [Field: CustName1]
    Use : Name Field
    Storage : CustName2
    [Field: BillNoTitle]
    Set as : "To"
    [Field: BillNo1]
    Use : Name Field
    Storage : BillNo
    [Field: BillAmt]
    Set as : "Bill Amount"
    [Field: BillAmt1]
    Use : Amount Field
    Storage : BillAmt
    [Field: Tripadv]
    Set as : "Trip Adv"
    [Field: Tripadv1]
    Use : Amount Field
    Storage : TripadAmt
    [System: UDF]
    CustName2 : String : 1009
    BillNo : String : 1010
    BillAmt : Amount : 1001
    TripadAmt : Amount : 1002
    BAggre : Aggregate : 1000
    ;-----------------------------------------------------------------------------------------------------------------
    [#Form : Journal Color]
    ;Delete : Print
    Add : Print : TripsettlementRepo
    [Report :TripsettlementRepo]
    Object : Voucher
    [Style:O9]
    Font:Calibri (Body)
    Height:9
    [Style:O9B]
    Use:O9
    Bold: Yes
    [Style:O9B1]
    Font:Calibri (Body)
    Height:6
    [Style:O11B]
    Font: Adobe Garamond Pro Bold
    Height:15
    Bold: Yes
    [Form : TripsettlementRepo]
    Space Top : 0.25 inch
    Space Right : 0.25 inch
    Space Left : 0.50 inch
    Space Bottom: 0.25 inch
    Parts : PYVCHCOmpanyAddr, firstTitledetails1, TSInvBody
    [Part: PYVCHCOmpanyAddr]
    Lines : Invoice Title1, PRCT Company1, Company Address1,Settle Title, Liner1
    [Line:Invoice Title1]
    Field: Simple Field
    Local: Field: Simple Field: Full Width: Yes
    Local: Field: Simple Field: Set as: "Sri Rama Jeyam"
    Local: Field: Simple Field: Style: O9B1
    Local: Field: Simple Field: Space Left: 41
    ; Local: Field: Name Field : Align: Centre
    [Line: PRCT Company1]
    Field: Name Field
    Local: Field: Name Field: Set as: @@CmpMailName
    Local: Field: Name Field: Style:O11B
    Local: Field: Name Field: Full Width: Yes
    ;Space Top: 0.25
    Local: Field: Name Field : Align: Centre
    [Line:Company Address1]
    Field: Name Field
    Local: Field: Name Field: Set as: $$FullList:CompanyAddress:$Address
    Local: Field: Name Field: Style:O9B
    Local: Field: Name Field: Full Width: Yes
    Local: Field: Name Field: Line:0
    Local: Field: Name Field : Align: Centre
    [Line:Settle Title]
    Field: Simple Field
    ; Right Field:Name Field
    Local: Field: Simple Field: Set as: "TRIP SETTLEMENT"
    Local: Field: Simple Field: Style: O9B
    Local: Field: Simple Field: Space Left: 38
    [Line : Liner1]
    field : Llinr1
    [Field : Llinr1]
    Skip : Yes
    FullWidth : Yes
    Align : Centre
    Border : Thin Bottom
    Style : "Normal Bold"
    [Part: firstTitledetails1]
    Line : Fi1LV Details1


    [Line : Fi1LV Details1]

    Field : Sedetails, Sedate, Vnumb1, Drnam1, Dielt1
    Border: Thick Cover


    [Field : Sedetails]
    Use : Name Field

    Set As : "Settlement No :" + $VoucherNumber + " " + "Date :"

    [Field : Sedate]
    Use : Date Field

    Set As : $Date
    [Field : Vnumb1]
    Use : Name Field
    Set As : " " + "Vehicle No : " + $Vhnum1
    [Field : Drnam1]
    Use : Name Field
    Set As : " " + "Dr Name : " + $Drname + " " + "Diesel Ltr: "
    [Field : Dielt1]
    Use : Name Field
    Set As : $Dieltr
    ;------------------------------------------------------------------------------------------------------------------------
    [Part:TSInvBody]
    Line: TsInvBody
    Repeat:TSInvBody: Inventory Entries
    Border: Thick Cover
    Scroll: Vertical
    Float: No
    Common Border: Yes
    [Line: TSInvBody]
    Field: OTS SrNo, TSDescrip

    Local: Field: TSSrNo: Width:2
    Local: Field: TSFromPlace: Width:20
    Local: Field: TSToPlace: Width: 20
    Local: Field: TSFreightAmt: Width:15
    Local: Field: TSTripAdv: Width:15
    Local: Field: TSSrNo: Border: Thick Right
    Local: Field: TSFromPlace: Border: Thick Left
    Local: Field: TSToPlace: Border: Thick Left
    Local: Field: TSFreightAmt: Border: Thick Left
    Local: Field: TSTripAdv: Border: Thick Left
    Space Top: 0.15
    [Field:OTS SrNo]
    Use: Simple Field
    Set as: $$Line
    Style: O9
    [Field:TSDescrip]
    Use: Simple Field
    Style: O9
    Set as: $CustName2
    Full Width: Yes
    Line: 0
     
    krishnankamalakannan likes this.



  11. Excellent sir, It give me the boost to learn. If I get such a great teacher I can do the wonders. Thank you so much sir. I will go through this code. When I print the report I am not getting the Vehicle no and others. But I try me best before come to you sir otherwise I will send my full code sir.
     


  12. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Well try more harder and diligently.......... all you need is patience and proper understanding. :):););)
     



  13. Your code is working fine sir. Still long way to go sir. When say the output really I felt soooooooo happy sir. Any how Its your code. But sure I will learn sir.
     



  14. In my Report Vehicle No, Driver Name and Diesel are now shown sir

    upload_2021-6-29_17-38-17.png
     



  15. Here is the code sir,

    [#Form : Journal Color]
    ;Delete : Print
    Add : Print : TripsettlementRepo
    [Report :TripsettlementRepo]
    Object : Voucher
    [Style:O9]
    Font:Calibri (Body)
    Height:9
    [Style:O9B]
    Use:O9
    Bold: Yes
    [Style:O9B1]
    Font:Calibri (Body)
    Height:6
    [Style:O11B]
    Font: Adobe Garamond Pro Bold
    Height:15
    Bold: Yes
    [Form : TripsettlementRepo]
    Space Top : 0.25 inch
    Space Right : 0.25 inch
    Space Left : 0.50 inch
    Space Bottom: 0.25 inch
    Parts : PYVCHCOmpanyAddr, firstTitledetails1, TSInvBody
    [Part: PYVCHCOmpanyAddr]
    Lines : Invoice Title1, PRCT Company1, Company Address1,Settle Title, Liner1
    [Line:Invoice Title1]
    Field: Simple Field
    Local: Field: Simple Field: Full Width: Yes
    Local: Field: Simple Field: Set as: "Sri Rama Jeyam"
    Local: Field: Simple Field: Style: O9B1
    Local: Field: Simple Field: Space Left: 41
    ; Local: Field: Name Field : Align: Centre
    [Line: PRCT Company1]
    Field: Name Field
    Local: Field: Name Field: Set as: @@CmpMailName
    Local: Field: Name Field: Style:O11B
    Local: Field: Name Field: Full Width: Yes
    ;Space Top: 0.25
    Local: Field: Name Field : Align: Centre
    [Line:Company Address1]
    Field: Name Field
    Local: Field: Name Field: Set as: $$FullList:CompanyAddress:$Address
    Local: Field: Name Field: Style:O9B
    Local: Field: Name Field: Full Width: Yes
    Local: Field: Name Field: Line:0
    Local: Field: Name Field : Align: Centre
    [Line:Settle Title]
    Field: Simple Field
    ; Right Field:Name Field
    Local: Field: Simple Field: Set as: "TRIP SETTLEMENT"
    Local: Field: Simple Field: Style: O9B
    Local: Field: Simple Field: Space Left: 38
    [Line : Liner1]
    field : Llinr1
    [Field : Llinr1]
    Skip : Yes
    FullWidth : Yes
    Align : Centre
    Border : Thin Bottom
    Style : "Normal Bold"
    [Part: firstTitledetails1]
    Line : Fi1LV Details1


    [Line : Fi1LV Details1]

    Field : Sedetails, Sedate, Vnumb1, Drnam1, Dielt1
    Border: Thick Cover


    [Field : Sedetails]
    Use : Name Field

    Set As : "Settlement No :" + $VoucherNumber + " " + "Date :"

    [Field : Sedate]
    Use : Date Field

    Set As : $Date
    [Field : Vnumb1]
    Use : Name Field
    Set As : " " + "Vehicle No : " + $Vhnomf
    [Field : Drnam1]
    Use : Name Field
    Set As : " " + "Dr Name : " + $Drnam + " " + "Diesel Ltr: "
    [Field : Dielt1]
    Use : Amount Field
    Set As : $Dieltr
     


  16. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    $LedgerEntries[].Vhnum1 ........likewise do it for your user defined UDFs.
     



  17. Sir, I tried as per your advice, but still I am not getting the result.


    [Line : Fi1LV Details1]

    Field : Sedetails, Sedate, Vnumb1 ;, Drnam1, Dielt1
    Border: Thick Cover


    [Field : Sedetails]
    Use : Name Field

    Set As : "Settlement No : " + $VoucherNumber + " " + "Date : "

    [Field : Sedate]
    Use : Date Field
    Set As : $Date

    [Field : Vnumb1]
    Use : Name Field
    Set As : " Vehicle No. : " + $LedgerEntries[].$Vhnum1


    upload_2021-6-30_10-4-14.png

    upload_2021-6-30_10-4-38.png
     


  18. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    My friend... you are not even able to copy/paste properly............

    See my code and check it with yours and rectify it.
     



  19. Sorry sir, Now I understood ie. $ sign not comes. But here I entered $ sign. Now I try and come to you sir. sorry once again
     



  20. Sir, Now I got the report this much (Screen shot shown). For print the 'From To Freight Amount Trip Advance' I given the following code but It shown error which is shown below sir. Please correct the error sir.

    upload_2021-6-30_12-44-40.png



    [Part : AcSalesPart]
    Line: AcSalesLineTitle, AcSalesDetails
    Repeat: AcSalesDetails : MySalesCollection1
    Scroll:Vertical
    Common Border: Yes

    [Line: AcSalesLineTitle]
    Use: BillDetailsD
    Local: Field: Default :Line: 2
    Local: Field: Default :Type : String
    Local: Field: Default : Align: Center


    Local: Field: B_From : Set as: "From"
    Local: Field: B_To: Set as: "To"
    Local: Field: B_Freight : Set as: "Freight"
    Local: Field: B_Advance: Set as: "Trip Advance"
    Border: Column Titles

    [Line: AcSalesDetails ]
    Left Field: B_From,B_To
    Right Field: B_Freight, B_Advance

    [Field:B_From]
    Use: Name Field
    Set as: $FromName
    Width: 20
    Border: Thin Right
    [Field:B_To]
    Use: Name Field
    Set as: $ToName
    Width: 20
    Border: Thin Right
    [Field:B_Freight]
    Use: Amount Field
    Set as: $FreightAmt
    Width: 10
    Border: Thin Right
    [Field:B_Advance]
    Use: Amount Field
    Set as: $TripadAmt
    Width: 7


    [Collection:MySalesCollection]
    Type: Voucher
    Fetch: FromName, ToName, FreightAmt, TripadAmt
    Filter:JourVCH


    [System:Formula]
    JourVCH : $$IsJournal:$VoucherTypeName



    [Collection:MySalesCollection1]
    Use:MySalesCollection
    Add: Filter: JourVCH

    upload_2021-6-30_12-46-2.png


    upload_2021-6-30_12-49-4.png
     


  21. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Hi friend... sorry.... you cannot have piecemeal solution to your own problem, when you are not even making a SERIOUS efforts.......

    From now on...you will get GUIDANCE only..........

    From above error message.... there is mismatch of storage properties........means you have defined the UDF as String, whereas the field would be something other than STRING.............so rectify that.

    And please do make sincere efforts...........;);):):)
     
    krishnankamalakannan likes this.


  22. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    You say you have made this code........yet you are UNABLE to even follow the BASICS.............

    If you have really made this, then you would be able to solve the issues.......we have given you GUIDANCE.........
     
    krishnankamalakannan likes this.



  23. Actually I don't know TDL sir, This is my first. I go through others TDL and get the idea, Suppose If I feel this code is use this place I can copy that code and correct accordingly. I am in LKG in TDL. If the errors arise, If you give me the guidence then I can understand the correct usage of the code. OK sir in future I write the code of my own. I never copy of anybodies code sir.
     


  24. abhinand vk

    abhinand vk Active Member

    krishnankamalakannan likes this.



  25. But I will assure you sir I put my sincere effort to learn sir. Here also I have lot of doubts sir. If you see my report. It is not correctly placed sir. The sub-form, report all are my own idea. I will give the other also sir in that report I get only outline sir. As per your guidence I should complete the report sir. I give the model to you sir. Before I told I will give you full module. Now you see the other report sir.
    upload_2021-6-30_15-24-20.png


    upload_2021-6-30_15-27-9.png
     

    Attached Files:



Share This Page