Skip to main content

Posts

Showing posts with the label invoice

Creating Free Text Invoice through X++ code

Job: Calling class from job to run the class public void freeTextInvoicePostTestJob() { Dialog dialog; DialogField dlgCustAcc; DialogGroup dialogPeriodLengthGroup, dialogPeriodLengthGroup1; DialogField dlgLedgerAcc; ; dialog = new Dialog("Free-Text Invoice"); dialogPeriodLengthGroup1 = dialog.addGroup('Cust Table'); dlgCustAcc = dialog.addField(typeid(CustAccount)); dialogPeriodLengthGroup = dialog.addGroup('Ledger Table'); dlgLedgerAcc = dialog.addField(typeid(LedgerAccount)); if(dialog.run()) { if(dlgCustAcc.value() && dlgLedgerAcc.value() != '') FreeTxtInvoiceCreatePost::main(dlgCustAcc.value(), dlgLedgerAcc.value()); else throw error(strfmt("Either CustAccount or LedgerAccount info is missing.")); } } Class: Which creates the free text invoice class FreeTxtInvoiceCreatePost { } static void main(CustAccount _custAccount, LedgerAccount _ledgerAccount) { CustInvoiceTable custInvoiceTable; ...

Print Sales Invoice Report in PDF / HTML / RTF / ASCII etc., format through code

SalesFormLetter salesFormLetter; PrintJobSettings printJobSettings; CustInvoiceJour custInvoiceJour; SalesId salesId; #File   salesid = "SO-100010"; salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice,false); printJobSettings = new PrintJobSettings(); printJobSettings.setTarget(PrintMedium::File); printJobSettings.format(PrintFormat); printJobSettings.fileName( '//10.0.57.22/AOSPrintShare//' + salesId+#pdf ); printJobSettings.warnIfFileExists(false); SalesFormLetter.updatePrinterSettingsFormLetter(printJobSettings.packPrintJobSettings()); select custInvoiceJour where custInvoiceJour.SalesId == salesId; custInvoiceJour.printJournal(salesFormLetter);

How to print a different Sales Invoice per company in AX

If you want to print a different Sales Invoice per every company you have, you must change the method printJournal in the table CustInvoiceJour and the form CustInvoiceJournal (MenuButton "SalesInvoiceShow" -> Copy, Original and Original print): Modified method printJournal for the table CustInvoiceJour: server void printJournal(SalesFormLetter salesFormLetter = null, RecordSortedList journalList = null, NoYes copy = NoYes::No) { Args parameters = new Args(); MenuFunction salesInvoiceMenu; ; // Show the correct report for the every company switch (strupr(curExt())) { case "OPP": salesInvoiceMenu = new MenuFunction(menuitemoutputstr(OPPSalesInvoice),MenuItemType::Output); break; default: salesInvoiceMenu = new MenuFunction(menuitemoutputstr(SalesInvoice),MenuItemType::O...

Delete Invoice double posted

Table affected: 1. InventTrans Key: Voucher 2. VendInvoiceJour Key: internalInvoiceId = Voucher 3. VendInvoiceTrans Key: internalInvoiceId = Voucher 4. VendInvoicePurchLink Key: internalInvoiceId = Voucher 5. VendTrans Key: Voucher 6. VendTransOpen Key: RefRecId = vendtrans.recid 7. LedgerTrans Key: Voucher delete all those record stored in the above table and 1. Create a job static void updateInventSum(Args _args) { InventSumReCalcItem inventSumRecalcItem = new InventSumreCalcItem("0100000000117-AV",true,CheckFix::Fix); ; inventSumrecalcItem.updateNow(); } Pass in the itemid affected or InventSumReCalcItem InventSumReCalcItem; ; InventSumReCalcItem = new InventSumReCalcItem("YourItemId" ); InventSumReCalcItem.updateNow(); 2. Run General Ledger->Periodic->Recalculate Ledger Balance

Modify InvoiceDate, TransDate .. on already posted Vendor Invoice

you have to try first run test system . static void xxx(Args _args) { invoiceId NumFacturaDesde; invoiceId NumFacturaHasta; CustInvoiceJour _custinvoicejour; CustInvoiceSalesLink _custinvoicesaleslink; CustInvoiceTrans _custinvoicetrans; LedgerTrans _ledgertrans; CustTrans _custtrans; CustTransOpen _custtransopen; InventTrans _inventtrans; TaxTrans _taxtrans; CustBillOfExchangeInvoice _CustBillOfExchangeInvoice; CustBillOfExchangeTrans _CustBillOfExchangeTrans; CustSetTlement _CustSetTlement; InvoiceDate FechaBuena; ; //Inicializamos variables NumFacturaDesde = '035884'; NumFacturaHasta = '035884'; FechaBuena = str2date("22.04.2005",123); ttsbegin; _custinvoicejour.clear(); SELECT FORUPDATE * FROM _custinvoicejour WHERE _custinvoicejour.InvoiceId>=NumFacturaDesde && _c...