how to write multiple sales invoice info. in text File?

mdsrmdsr Posts: 138Member
i have write code for writing single sales invoice info. in text format.but now i want to multiple sales invoice info write on text file on each new line based on check mark on before each posted sales invoice (boolean field ) so when i click check marks those posted sales invoice info should appear in text file.I tried a lot but now so confuse how to do it can any expert help me in this case
for single line info following code:
txtTempFilename:=FileManagement.ServerTempFileName('Encript.txt');
File1.CREATE(txtTempFilename);
File1.CREATEOUTSTREAM(Outstream1);

Outstream1.WRITETEXT(FORMAT(Plant)+','+ OurVendorCode +','+ CompGSTNo+','+ HSNCODE+','+FORMAT(0)+','+"PartNo." +','+"External Document No."+','+FORMAT("Line Item No")+
','+"No." +','+FORMAT(PostingDate)+','+DELCHR(FORMAT(Qty,0,'<Integer Thousand><Decimal,3>'),'=',',')+','+DELCHR(FORMAT(Rate,0,'<Integer Thousand><Decimal,3>'),'=',',')+
','+DELCHR(FORMAT(Amount,0,'<Integer Thousand><Decimal,3>'),'=',',')+','+FORMAT(0)+','+FORMAT(0)+','+FORMAT(0)+
','+DELCHR(FORMAT(Amount,0,'<Integer Thousand><Decimal,3>'),'=',',')+','+FORMAT(0)+','+DELCHR(FORMAT(Amount,0,'<Integer Thousand><Decimal,3>'),'=',',')+
','+DELCHR(FORMAT(vCGSTRate,0,'<Integer Thousand><Decimal,3>'),'=',',')+','+DELCHR(FORMAT(vCGSTAmount,0,'<Integer Thousand><Decimal,3>'),'=',',')+
','+DELCHR(FORMAT(vSGSTRate,0,'<Integer Thousand><Decimal,3>'),'=',',')+','+DELCHR(FORMAT(vSGSTAmount,0,'<Integer Thousand><Decimal,3>'),'=',',')+
','+DELCHR(FORMAT(vIGSTRate,0,'<Integer Thousand><Decimal,0>'),'=',',')+','+DELCHR(FORMAT(vIGSTAmount,0,'<Integer Thousand><Decimal,0>'),'=',',')+','+FORMAT(0)+
','+FORMAT(0)+','+DELCHR(FORMAT("Amount to Customer",0,'<Integer Thousand><Decimal,3>'),'=',',')+','+','+','+"Vehicle No."+','+ PackingDetails +',');

Outstream1.WRITETEXT;
File1.CLOSE;
FileManagement.DownloadToFile(txtTempFilename,'C:\NAV EDI\Encript.txt');
MESSAGE('EDI File Crearted Successfully');
for multiple posted sales invoice ???

Answers

  • MaaaxMaaax Strasbourg, FrancePosts: 14Member
    edited 2019-08-16
    Hi!
    I'm not sure to understand your problem, but you need to loop trough your marked/checked invoices :
    [...]
    File1.CREATEOUTSTREAM(Outstream1);
    
    // Filter SalesInvoiceHeader
    IF SalesInvoiceHeader.FINDSET(FALSE) THEN REPEAT
    Outstream1.WRITETEXT(FORMAT(Plant)+','+ OurVendorCode +','+ CompGSTNo+','+       HSNCODE+','+FORMAT(0)+','+"PartNo." +','+"External Document No."+','+FORMAT("Line Item No")+
    ','+"No." +','+FORMAT(PostingDate)+','+DELCHR(FORMAT(Qty,0,'<Integer Thousand><Decimal,3>'),'=',',')+','+DELCHR(FORMAT(Rate,0,'<Integer Thousand><Decimal,3>'),'=',',')+
    ','+DELCHR(FORMAT(Amount,0,'<Integer Thousand><Decimal,3>'),'=',',')+','+FORMAT(0)+','+FORMAT(0)+','+FORMAT(0)+
    ','+DELCHR(FORMAT(Amount,0,'<Integer Thousand><Decimal,3>'),'=',',')+','+FORMAT(0)+','+DELCHR(FORMAT(Amount,0,'<Integer Thousand><Decimal,3>'),'=',',')+
    ','+DELCHR(FORMAT(vCGSTRate,0,'<Integer Thousand><Decimal,3>'),'=',',')+','+DELCHR(FORMAT(vCGSTAmount,0,'<Integer Thousand><Decimal,3>'),'=',',')+
    ','+DELCHR(FORMAT(vSGSTRate,0,'<Integer Thousand><Decimal,3>'),'=',',')+','+DELCHR(FORMAT(vSGSTAmount,0,'<Integer Thousand><Decimal,3>'),'=',',')+
    ','+DELCHR(FORMAT(vIGSTRate,0,'<Integer Thousand><Decimal,0>'),'=',',')+','+DELCHR(FORMAT(vIGSTAmount,0,'<Integer Thousand><Decimal,0>'),'=',',')+','+FORMAT(0)+
    ','+FORMAT(0)+','+DELCHR(FORMAT("Amount to Customer",0,'<Integer Thousand><Decimal,3>'),'=',',')+','+','+','+"Vehicle No."+','+ PackingDetails +',');
    Outstream1.WRITETEXT;
    UNTIL SalesInvoiceHeader.NEXT = 0;
    [...]
    
    Maxime JUND
    Talent Business Solutions
    Technical Expert of Microsoft Dynamics 365 Business Central
    Website | Mail | LinkedIn
  • souoiksouoik Posts: 96Member
    edited 2019-12-04
    @Maaax hi please i need to export payment journal as file .TXT simple format not ACH or SEEPA please ho can do this this is my first work in this project, am workin in nav 2009R2 classic client
Sign In or Register to comment.