form

surisuri Member Posts: 123
question:
Create a report that will create a line in Gen Journal for each customer with his outstanding balance

good evening all,
this is assignment question
i have written the code in
on after get record() and set the property is processing only yes

Customer.CALCFIELDS(Customer.Balance);
IF Customer.Balance <>0 THEN
BEGIN
gjline.INIT;
gjline.SETRANGE(gjline."Journal Template Name",'general');
gjline.SETRANGE(gjline."Journal Batch Name",'default');
gjline."Balance (LCY)" :=Customer.Balance;
gjline.INSERT
END
but it was showing the error ,i am sharing the screen
what about this error,what i have written is correct or wrong any suggest me please
thank you

Comments

  • ppavukppavuk Member Posts: 334
    what do you trying to achieve with this meaningless code?
  • surisuri Member Posts: 123
    i am beginner i am week in writing the code ,
    can you suggest me the code
    thank you
  • ppavukppavuk Member Posts: 334
    Why not to read programming guide to get the basics?
  • surisuri Member Posts: 123
    good morning
    can you forward the programming guide please
    thank you
  • lavanyaballurgilavanyaballurgi Member Posts: 235
    search "c side programming pdf" in google and you should be able to get some guides...

    A similar kinda option is there in Payment Journal > Function > Suggest Vendor Payment which list out the vendor with outstanding payments.

    What I found missing in your development was -
    1. Document No.
    2. Account Type (should be CUSTOMER)
    3. Account No. (should be the Customer No.)
    4. Line No. (starts with 10000)

    Try to get these in you Code.
  • surisuri Member Posts: 123
    hi thanks for giving reply one and all

    i have tried this code in on after get record.but it was throwing an error

    Customer.CALCFIELDS(Customer.Balance);
    IF Customer.Balance <>0 THEN
    MESSAGE('%1',Customer.Balance);
    gjline.RESET;
    gjline.SETRANGE(gjline."Journal Template Name",'Assets');
    gjline.SETRANGE(gjline."Journal Batch Name",'Default');

    gjline.VALIDATE(gjline."Journal Template Name",'Assets');
    gjline.VALIDATE(gjline."Journal Batch Name",'Default');
    gjline.INIT;
    line :=0;
    IF gjline.FINDLAST THEN
    gjline."Line No.":=line+ 10000
    ELSE
    gjline."Line No.":=gjline."Line No."+10000;
    gjline."Account Type":=gjline."Account Type"::Customer;
    gjline."Account No." :=Customer."No.";
    gjline."Balance (LCY)" :=Customer.Balance;
    gjline.INSERT
    err.PNG 23.9K
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    COde should be
    IF gjline.FINDLAST THEN
      gjline."Line No." := gjline."Line No." + 10000
    ELSE
      gjline."Line No." := 10000;
    

    Better you validate Account Type, Account No. fields..
  • surisuri Member Posts: 123
    the code what i have written is working fine
    i used if not instead of if
    IF not gjline.FINDLAST THEN
    gjline."Line No.":=line+ 10000
    ELSE
    gjline."Line No.":=gjline."Line No."+10000;
    gjline."Account Type":=gjline."Account Type"::Customer;
    gjline."Account No." :=Customer."No.";
    gjline."Balance (LCY)" :=Customer.Balance;
    gjline.INSERT
    thanks for giving reply and spending your valuable time
  • lavanyaballurgilavanyaballurgi Member Posts: 235
    Better to use VALIDATE like this ..

    gjline.VALIDATE("Account No.",Customer."No.");

    and dont forget to mark it as SOLVED if your query is resolved.
Sign In or Register to comment.