Quantcast
Channel: AX Developer Forum
Viewing all articles
Browse latest Browse all 9880

project hour journals

$
0
0

Hai ,

I want to write code for project hour journal in ax 2009 .. but i cant get exact code for it .. the given code is in ax 2012 can you please say where i want to modify in this code for ax 2009 project hour journals ...

 

static void ProjectHoursJournalCreate(Args _args)

{

    ProjJournalTableData    JournalTableData;

    ProjJournalTransData    journalTransData;

    ProjJournalTable        journalTable;

    ProjJournalTrans        journalTrans;

    ProjTable               projTable;

    CommaTextIO             csvFile;

    container               readCon;

    counter                 icount,inserted;

    Dialog                  dialog;

    DialogField             dfFileName;

    FileName                fileName;

 

    inserted =0;

    #File

 

 

    dialog = new Dialog("Pick the file");

    dfFileName = dialog.addField(extendedTypeStr("FilenameOpen"));

    dialog.filenameLookupFilter(["All files", #AllFiles]);

 

    if (dialog.run())

    {

        csvFile = new CommaTextIo(dfFileName.value(), 'r');

        csvFile.inFieldDelimiter(',');

        readCon = csvFile.read();

        ttsBegin;

 

        journalTableData = JournalTableData::newTable(journalTable);

        journalTransData = journalTableData.journalStatic().newJournalTransData(journalTrans,journalTableData);

        // Init JournalTable

        journalTable.clear();

        journalTable.JournalId = journalTableData.nextJournalId();

        journalTable.JournalType = ProjJournalType::Hour;

        journalTable.JournalNameId = "hours";

 

 

        while(csvFile.status() == IO_Status::OK)

        {

            readCon = csvFile.read();

 

            if(readCon)

            {

                icount++;

 

                // Init JournalTrans

                journalTableData.initFromJournalName(journalTableData.journalStatic().findJournalName(journalTable.JournalNameId));

 

                journalTrans.clear();

                journalTransData.initFromJournalTable();

                projTable                      = ProjTable::find(conPeek(readCon,1));

                journalTrans.TransDate = systemDateGet();

                journalTrans.ProjTransDate = systemDateGet();

                journalTrans.ProjId = conPeek(readCon,1);

                journalTrans.Qty = str2num(conPeek(readCon,2));

                journalTrans.SalesPrice = str2num(conPeek(readCon,3));

                journalTrans.CostPrice =  1;//str2num(conPeek(readCon,4));

                journalTrans.Txt = projTable.psaRetainageBillingDesc();

                journalTrans.CurrencyId = ProjInvoiceTable::find(projTable.ProjInvoiceProjId).CurrencyId;

                journalTrans.Worker = HcmWorker::userId2Worker(curUserId());

                journalTrans.CategoryId = "design";

                journalTrans.LinePropertyId = "charge";

                journalTrans.Voucher = NumberSeq::newGetVoucherFromCode(JournalTable.getNumberSequenceTable().NumberSequence).voucher();

                journalTransData.create();

 

 

 

            }

 

        }

        journalTable.insert();

        ttsCommit;

    }

 

 

}


Viewing all articles
Browse latest Browse all 9880

Trending Articles