Vous êtes sur la page 1sur 1

[DataMethod(), AxSessionPermission(SecurityAction.

Assert)] public static DataTable dmInventory(DateTime fromDate, DateTime toDate) { //create AxSession and log on to Axapta AxaptaWrapper axSession = SessionManager.GetSession(); //Declare Axapta variables AxaptaRecordWrapper tmpInventory = null; AxaptaObjectWrapper objInvent = null; //Create table structure used by report DataTable dtInventory = new DataTable(); dtInventory.Columns.Add("Account", typeof(string)); dtInventory.Columns.Add("AccountName", typeof(string)); dtInventory.Columns.Add("Posting", typeof(string)); dtInventory.Columns.Add("Voucher", typeof(string)); dtInventory.Columns.Add("DateFinancial", typeof(DateTime)); dtInventory.Columns.Add("CostAmountPosted", typeof(double)); dtInventory.Columns.Add("CostAmountPostedLedger", typeof(double)); // calling classes and class methods objInvent = (AxaptaObjectWrapper)axSession.CreateAxaptaObject (axSession.CallStaticClassMethod(FIMAxClasses.inventoryReport, FIMAxClassMethods.inventReport, fromDate, toDate, 0, true)); objInvent.Call(FIMAxClassMethods.inventCalcData); tmpInventory = (AxaptaRecordWrapper)axSession.CreateAxaptaRecord(objInvent.Call(FIMAxClassMethods.inventBalance)); // adding the data into the data table while (tmpInventory.Found) { DataRow mainRow = dtInventory.NewRow(); mainRow["Account"] = Convert.ToString(tmpInventory.GetField("Account")); mainRow["AccountName"] = objInvent.Call(FIMAxClassMethods.inventAccount, Convert.ToString(tmpInventory.GetField("Account"))); mainRow["DateFinancial"] = (DateTime)tmpInventory.GetField("DateFinancial"); mainRow["CostAmountPosted"] = Convert.ToString(tmpInventory.GetField("CostAmountPosted")); mainRow["Voucher"] = Convert.ToString(tmpInventory.GetField("Voucher")); mainRow["Posting"] = FIMCommonHelper.GetEnumLabel(axSession, FIMAxEnumNames.ledgerPostingType, Convert.ToInt32(tmpInventory.GetField("Posting"))); mainRow["CostAmountPostedLedger"] = Convert.ToString(tmpInventory.GetField("CostAmountPostedLedger")); dtInventory.Rows.Add(mainRow); tmpInventory.Next(); } //Return the data table return dtInventory; }

Comment [AC1]: Creeaza o sesiune

Comment [AC2]: table Comment [AC3]: clasa

Vous aimerez peut-être aussi