Hi experts!!
I'm trying to export an sales invoice posted to .txt and I have no problems with any field except with the value of "Amount" and "Amount Including VAT", both return me 0 but in the table (112) there are other value
I don't understand why I can't export the values if the report has the dataitem "Sales Invoice Header" and into this dataitem exists the fields with values <>0
this is my code:
report_50016_factura_electronica
OnPreReport=BEGIN
OutFile.TEXTMODE := TRUE;
OutFile.WRITEMODE := TRUE;
OutFile.CREATE(ExternalFile);
END;
}
DATAITEMS
{
{ PROPERTIES
{
DataItemTable=Table112;
NewPagePerRecord=Yes;
OnAfterGetRecord=BEGIN
company.RESET;
company.GET;
OutText := '33' +"Sales Invoice Header"."No.";
OutFile.WRITE(OutText);
{OutText := 'A:Tipo|33';
OutFile.WRITE(OutText);}
OutText := 'A:Folio Documento|'+FORMAT("Sales Invoice
Header"."No.");
OutFile.WRITE(OutText);
OutText := 'A:Fecha emision|'+FORMAT("Sales Invoice
Header"."Posting Date");
OutFile.WRITE(OutText);
OutText := 'A:Terminos del pago|'+FORMAT("Sales
Invoice Header"."Payment Terms Code");
OutFile.WRITE(OutText);
OutText := 'A:Fecha de vencimiento|'+FORMAT("Sales
Invoice Header"."Due Date");
OutFile.WRITE(OutText);
OutText:= 'A:Direcci¢n Origen|'+CompanyInfo.Address;
OutFile.WRITE(OutText);
OutText:= 'A:Comuna Origen|'+CompanyInfo.City;
OutFile.WRITE(OutText);
.
.
.
.
OutText := 'A:Monto neto|' +FORMAT("Sales Invoice
Header".Amount);
OutFile.WRITE(OutText);
OutText := 'A:Total|' +FORMAT("Sales Invoice
Header"."Amount Including VAT");
OutFile.WRITE(OutText);
END;
.
.
.
.
this is the result:
A:Folio Documento|103002
A:Fecha emisi¢n|02/12/14
A:Terminos del pago|CONTADO
A:Fecha de vencimiento|02/12/14
A:Dirección Origen|La Estera 668, Loteo Valle Grande
A:Comuna Origen|LAMPA
A:RUT receptor|03680941-8
A:Razón social receptor|MARLON MOLINA CARRASCO
A:Giro receptor|ARTICULOS ELECTRICOS
A:Dirección receptor|SAN DIEGO # 1128
A:Comuna receptor|SANTIAGO
A:Monto neto|0
A:Total|0
and these are the data in the table:
No. Bill-to Name Amount Amount Including VAT
103002 MARLON MOLINA CARRASCO 8.000 9.520
thanks!!
0
Comments
Tino Ruijs
Microsoft Dynamics NAV specialist
thank you very much.
Tino Ruijs
Microsoft Dynamics NAV specialist
I would like to export the file with the invoice number like name, but does not work me
Report - OnPreReport()
OutFile.CREATE(ExternalFile);
Request form - Oninit()
IF ExternalFile = '' THEN
ExternalFile := 'C:\E-invoice\'+FORMAT(STRSUBSTNO(Text011,"Sales Invoice Header"."No."));
C/AL globals:
Name ConstValue
Text011 INVOICE No %1 .txt
but the result is: C:\E-invoice\INVOICE No .txt
and I need: C:\E-invoice\INVOICE No103110.txt
Can you help me?
thanks again
When calling the export report, you must first call a function you create on the report called SetInvoiceNo with parameter InvoiceNo.
Create a global InvNo in the report which gets assigned in SetInvoiceNo.
And then in OnInit request form you can use InvNo.
Tino Ruijs
Microsoft Dynamics NAV specialist
the result is the same
Like this;
Tino Ruijs
Microsoft Dynamics NAV specialist
No, where?
Tino Ruijs
Microsoft Dynamics NAV specialist
Request form - Oninit()
IF ExternalFile = '' THEN
ExternalFile := 'C:\E-invoice\'+FORMAT(STRSUBSTNO(Text011,"Sales Invoice Header"."No."));
then it would ExternalFile.Run?
but ExternalFile is not a record, is invalid for Run
You will need to call the report from a page/form or codeunit. Otherwise you won't be able to set the invoice no.
Tino Ruijs
Microsoft Dynamics NAV specialist